aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index 95f459b4..70555fca 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -35,6 +35,7 @@ import com.juick.service.*;
import com.juick.util.DateFormattersHolder;
import com.juick.util.MessageUtils;
import org.apache.commons.codec.CharEncoding;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
@@ -1286,4 +1287,20 @@ public class ServerTests {
mockMvc.perform(get("/auth").with(httpBasic(userName, userPassword))).andExpect(status().isUnauthorized());
}
+ @Test
+ public void bannedUserShouldBeShadowedFromRecommendationsList() throws IOException {
+ int ermineId = userService.createUser("ermine", "secret");
+ int monstreekId = userService.createUser("monstreek", "secret");
+ int pogoId = userService.createUser("pogo", "secret");
+ int fmapId = userService.createUser("fmap", "secret");
+ int mid = messagesService.createMessage(monstreekId, "KURWA", null, null);
+ assertThat(messagesService.recommendMessage(mid, ermineId), is(MessagesService.RecommendStatus.Added));
+ assertThat(messagesService.recommendMessage(mid, fmapId), is(MessagesService.RecommendStatus.Added));
+ assertThat(messagesService.recommendMessage(mid, pogoId), is(MessagesService.RecommendStatus.Added));
+ assertThat(messagesService.getMessage(mid).getLikes(), is(3));
+ assertThat(CollectionUtils.isEqualCollection(messagesService.getMessageRecommendations(mid), Arrays.asList("fmap", "ermine", "pogo")), is(true));
+ privacyQueriesService.blacklistUser(userService.getUserByName("monstreek"), userService.getUserByName("pogo"));
+ assertThat(messagesService.getMessage(mid).getLikes(), is(3));
+ assertThat(CollectionUtils.isEqualCollection(messagesService.getMessageRecommendations(mid), Arrays.asList("fmap", "ermine")), is(true));
+ }
}