diff options
author | Vitaly Takmazov | 2018-03-07 14:53:23 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-13 08:12:18 +0300 |
commit | 1f5869fcfe8c537d223b750754025cb2937d4bad (patch) | |
tree | adb9e8f12e41eb4f2659ea4079c05729d42f33c1 /juick-server-jdbc/src/test/java/com | |
parent | c25f908aa587a60912f7350806e54de2b7f3dc04 (diff) |
drop replies tree
Diffstat (limited to 'juick-server-jdbc/src/test/java/com')
-rw-r--r-- | juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java | 14 |
1 files changed, 13 insertions, 1 deletions
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<Message> 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<Message> 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")); |