From 906bf8ef21463f99820764807b656cb617b0aaa2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 28 Jan 2023 18:24:32 +0300 Subject: Cleanup Tag model --- src/test/java/com/juick/server/tests/ServerTests.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/test/java/com/juick/server/tests') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index dba662b0..d695ffb8 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -732,7 +732,7 @@ public class ServerTests { assertThat(topCandidates.size(), is(1)); assertThat(topCandidates.get(0), is(topmid)); Tag juickTag = tagService.getTag("juick", false); - assertThat(juickTag.TID, is(2)); + assertThat(juickTag.getId(), is(2)); tagService.updateTags(topmid, Collections.singletonList(juickTag)); assertThat(messagesService.getPopularCandidates().isEmpty(), is(true)); tagService.updateTags(topmid, Collections.singletonList(juickTag)); @@ -746,9 +746,7 @@ public class ServerTests { CommandResult resultUndo = commandsManager.commandRecommend(serviceUser, URI.create(""), String.valueOf(topmid)); assertThat(messagesService.getPopularCandidates().isEmpty(), is(false)); - jdbcTemplate.update("INSERT INTO tags(tag_id, name) VALUES(805, 'NSFW')"); - Tag nsfw = tagService.getTag("NSFW", false); - assertThat(nsfw.TID, equalTo(805)); + Tag nsfw = tagService.getTag("NSFW", true); tagService.updateTags(topmid, Collections.singletonList(nsfw)); assertThat(messagesService.getPopularCandidates().isEmpty(), is(true)); User recommender = userService.createUser("recommender2", "x").orElseThrow(IllegalStateException::new); @@ -1277,8 +1275,8 @@ public class ServerTests { commandsManager.processCommand(ugnich, "BL @freefd", emptyUri); Tag tag = tagService.getTag("linux", true); int freefdMsg = messagesService.createMessage(freefd.getUid(), "sux", null, Set.of(tag)); - assertThat(messagesService.getTag(tag.TID, freefd.getUid(), 0, 10).size(), is(1)); - assertThat(messagesService.getTag(tag.TID, ugnich.getUid(), 0, 10).size(), is(0)); + assertThat(messagesService.getTag(tag.getId(), freefd.getUid(), 0, 10).size(), is(1)); + assertThat(messagesService.getTag(tag.getId(), ugnich.getUid(), 0, 10).size(), is(0)); messagesService.recommendMessage(freefdMsg, serviceUser.getUid()); assertThat(messagesService.getUserBlogWithRecommendations(serviceUser, ugnich, 0, 0) .contains(freefdMsg), -- cgit v1.2.3