From 1f5869fcfe8c537d223b750754025cb2937d4bad Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 7 Mar 2018 14:53:23 +0300 Subject: drop replies tree --- .../test/java/com/juick/service/MessageServiceTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'juick-server-jdbc/src/test/java') diff --git a/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java b/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java index 4ebfe056..d24a6281 100644 --- a/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java +++ b/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java @@ -159,8 +159,20 @@ public class MessageServiceTest extends AbstractJUnit4SpringContextTests { User ugnich = userService.getUserByUID(ugnich_id).orElse(new User()); int rid = messagesService.createReply(msg2.getMid(), 0, ugnich.getUid(), "bla-bla", null); assertEquals(1, rid); + assertThat(msg2.getTo(), equalTo(null)); + Message reply = messagesService.getReply(msg2.getMid(), rid); + assertThat(reply.getTo().getName(), equalTo(user.getName())); + List replies = messagesService.getReplies(msg2.getMid()); + assertThat(replies.size(), equalTo(1)); + assertThat(replies.get(0), equalTo(reply)); + int ridToReply = messagesService.createReply(msg2.getMid(), 1, ugnich_id, "blax2", null); + Message reply2 = messagesService.getReply(msg2.getMid(), ridToReply); + assertThat(reply.getTo().getName(), equalTo(user.getName())); + List replies2 = messagesService.getReplies(msg2.getMid()); + assertThat(replies2.size(), equalTo(2)); + assertThat(replies2.get(1), equalTo(reply2)); Message msg3 = messagesService.getMessage(mid2); - assertEquals(1, msg3.getReplies()); + assertEquals(2, msg3.getReplies()); assertEquals("weather", msg3.getTags().get(0).getName()); assertEquals(ugnich.getUid(), userService.checkPassword(ugnich.getName(), "x")); assertEquals(-1, userService.checkPassword(ugnich.getName(), "xy")); -- cgit v1.2.3