diff options
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Messages.java | 2 | ||||
-rw-r--r-- | juick-www/src/test/java/com/juick/www/WebAppTests.java | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Messages.java b/juick-www/src/main/java/com/juick/www/controllers/Messages.java index 5a76256e..d862e979 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Messages.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Messages.java @@ -224,7 +224,7 @@ public class Messages { ModelMap model) throws IOException { com.juick.User user = userService.getUserByName(uname); com.juick.User visitor = UserUtils.getCurrentUser(); - if (user.isBanned()) { + if (user.isBanned() || user.isAnonymous()) { throw new HttpNotFoundException(); } diff --git a/juick-www/src/test/java/com/juick/www/WebAppTests.java b/juick-www/src/test/java/com/juick/www/WebAppTests.java index dcbcb66c..01dfcdcb 100644 --- a/juick-www/src/test/java/com/juick/www/WebAppTests.java +++ b/juick-www/src/test/java/com/juick/www/WebAppTests.java @@ -325,4 +325,8 @@ public class WebAppTests { .andExpect(model().attribute("visitor", hasProperty("authHash", equalTo(hash)))) .andExpect(content().string(containsString(hash))); } + @Test + public void nonExistentBlogShouldReturn404() throws Exception { + mockMvc.perform(get("/ololoe/")).andExpect(status().isNotFound()); + } } |