diff options
Diffstat (limited to 'src/test/java/com/juick/server/tests')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 4b0de65d..7c038058 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -798,9 +798,8 @@ public class ServerTests { Timestamp lastreply = jdbcTemplate.queryForObject("SELECT lastmessage FROM users WHERE id=?", Timestamp.class, user.getUid()); assertThat(lastreply.toInstant(), equalTo(reply.getTimestamp())); assertEquals("should be reply to second comment", 2, reply.getReplyto()); - assertEquals("tags should NOT be updated", "It is not your message", - commandsManager.processCommand(readerUser, "#" + mid + " *yo *there", emptyUri) - .getText()); + assertThat(commandsManager.processCommand(readerUser, "#" + mid + " *yo *there", emptyUri) + .getText(), startsWith("Reply posted")); assertEquals("tags should be updated", "Tags are updated", commandsManager.processCommand(user, "#" + mid + " *there", emptyUri).getText()); assertEquals("number of tags should match", 2, @@ -1809,4 +1808,14 @@ public class ServerTests { com.juick.User testuser = jsonMapper.readValue(result.getResponse().getContentAsString(), User.class); assertThat(testuser.getName(), is("testuser")); } + @Test + public void doNotAllowRepliesToNonExistingReplyAndNotAllowToEditTagsOfComment() throws Exception { + assertThat(commandsManager.processCommand(ugnich, "#23213213/2 BAD COMMENT", emptyUri).getText(), is("Message not found")); + Message msg = commandsManager.processCommand(ugnich, "YO", emptyUri).getNewMessage().get(); + assertThat(commandsManager.processCommand(ugnich, String.format("#%d/1 BAD COMMENT", msg.getMid()), emptyUri).getText(), is("Reply not found")); + CommandResult result = commandsManager.processCommand(freefd, + String.format("#%d *GOOD *COMMENT", msg.getMid()), emptyUri); + Message reply = result.getNewMessage().get(); + assertThat(commandsManager.processCommand(ugnich, String.format("#%d/%d *GOOD *BAD", reply.getMid(), reply.getRid()), emptyUri).getText(), startsWith("Reply posted")); + } } |