From ad99117a15062a3819dad1f52a072e9694a954df Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 11 Apr 2018 21:34:14 +0300 Subject: server: last read marker for threads --- juick-www/src/test/java/com/juick/WebAppTests.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'juick-www/src/test/java/com') diff --git a/juick-www/src/test/java/com/juick/WebAppTests.java b/juick-www/src/test/java/com/juick/WebAppTests.java index e383a0a9..37798d08 100644 --- a/juick-www/src/test/java/com/juick/WebAppTests.java +++ b/juick-www/src/test/java/com/juick/WebAppTests.java @@ -167,7 +167,7 @@ public class WebAppTests { public void repliesList() throws IOException { int mid = messagesService.createMessage(ugnich.getUid(), "hello", null, null); IntStream.range(1, 15).forEach(i -> - messagesService.createReply(mid, i-1, freefd.getUid(), String.valueOf(i-1), null )); + messagesService.createReply(mid, i-1, freefd, String.valueOf(i-1), null )); HtmlPage threadPage = webClient.getPage(String.format("http://localhost:8080/ugnich/%d", mid)); assertThat(threadPage.getWebResponse().getStatusCode(), equalTo(200)); @@ -181,7 +181,7 @@ public class WebAppTests { @Test public void userShouldNotSeeReplyButtonToBannedUser() throws Exception { int mid = messagesService.createMessage(ugnich.getUid(), "freefd bl me", null, null); - messagesService.createReply(mid, 0, ugnich.getUid(), "yo", null); + messagesService.createReply(mid, 0, ugnich, "yo", null); MvcResult loginResult = mockMvc.perform(post("/login") .param("username", freefdName) .param("password", freefdPassword)).andReturn(); @@ -198,7 +198,8 @@ public class WebAppTests { privacyQueriesService.blacklistUser(freefd, ugnich); assertThat(userService.isInBLAny(freefd.getUid(), ugnich.getUid()), equalTo(true)); int renhaId = userService.createUser("renha", "secret"); - messagesService.createReply(mid, 0, renhaId, "people", null); + messagesService.createReply(mid, 0, userService.getUserByUID(renhaId).orElseThrow(IllegalStateException::new), + "people", null); threadPage = webClient.getPage(String.format("http://localhost:8080/ugnich/%d", mid)); assertThat(threadPage.getWebResponse().getStatusCode(), equalTo(200)); assertThat(threadPage.querySelectorAll(".msg-comment-target").isEmpty(), equalTo(true)); @@ -292,7 +293,7 @@ public class WebAppTests { .param("body", String.format("D #%d/%d", mid, 3))) .andExpect(status().isFound()); Thread.sleep(5000); - assertThat(messagesService.getReplies(mid).size(), equalTo(2)); + assertThat(messagesService.getReplies(ugnich, mid).size(), equalTo(2)); } @Test public void hashLoginShouldNotUseSession() throws Exception { @@ -342,7 +343,7 @@ public class WebAppTests { discussions = (HtmlPage) discussions.refresh(); assertThat(discussions.querySelectorAll("article").size(), is(2)); assertThat(discussions.querySelectorAll("article").get(0).getAttributes().getNamedItem("data-mid").getNodeValue(), is(String.valueOf(midNew))); - messagesService.createReply(mid, 0, freefd.getUid(), "I'm replied", null); + messagesService.createReply(mid, 0, freefd, "I'm replied", null); discussions = (HtmlPage) discussions.refresh(); assertThat(discussions.querySelectorAll("article").size(), is(2)); assertThat(discussions.querySelectorAll("article").get(0).getAttributes().getNamedItem("data-mid").getNodeValue(), is(String.valueOf(mid))); @@ -358,7 +359,7 @@ public class WebAppTests { assertThat(discussions.querySelectorAll("article").size(), is(20)); assertThat(discussions.querySelectorAll("article") .get(19).getAttributes().getNamedItem("data-mid").getNodeValue(), is(String.valueOf(mid))); - messagesService.createReply(midNew, 0, freefd.getUid(), "I'm replied", null); + messagesService.createReply(midNew, 0, freefd, "I'm replied", null); discussions = (HtmlPage) discussions.refresh(); assertThat(discussions.querySelectorAll("article") .get(0).getAttributes().getNamedItem("data-mid").getNodeValue(), is(String.valueOf(midNew))); -- cgit v1.2.3