aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-jdbc/src/test')
-rw-r--r--juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java14
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"));