From 5518faa7d7c28ae2a996fe057e7747d3b307c749 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 15 Aug 2018 15:05:42 +0300 Subject: Recommendation subscribers should not contain message author --- .../test/java/com/juick/server/tests/ServerTests.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'juick-server/src/test') 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 646e1443..297a3c88 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 @@ -1183,21 +1183,24 @@ public class ServerTests { Tag sampleTag = tagService.getTag("banned", true); int posterMid = messagesService.createMessage(posterId, "YO", null, Collections.singletonList(sampleTag)); messagesService.recommendMessage(posterMid, recommenderId); - BiFunction> subscribers = (recommId, msgId) -> - subscriptionService.getUsersSubscribedToUserRecommendations(recommId, msgId, posterId); - List recommendSubscribers = subscribers.apply(recommenderId, posterMid); + BiFunction> subscribers = (recommId, msg) -> + subscriptionService.getUsersSubscribedToUserRecommendations(recommId, msg); + List recommendSubscribers = subscribers.apply(recommenderId, messagesService.getMessage(posterMid)); assertThat(recommendSubscribers.size(), is(1)); assertThat(recommendSubscribers.get(0).getUid(), is(readerId)); privacyQueriesService.blacklistUser(reader, poster); - assertThat(subscribers.apply(recommenderId, posterMid).size(), is(0)); + assertThat(subscribers.apply(recommenderId, messagesService.getMessage(posterMid)).size(), is(0)); privacyQueriesService.blacklistUser(reader, poster); - assertThat(subscribers.apply(recommenderId, posterMid).size(), is(1)); + assertThat(subscribers.apply(recommenderId, messagesService.getMessage(posterMid)).size(), is(1)); tagService.blacklistTag(reader, sampleTag); - assertThat(subscribers.apply(recommenderId, posterMid).size(), is(0)); + assertThat(subscribers.apply(recommenderId, messagesService.getMessage(posterMid)).size(), is(0)); tagService.blacklistTag(reader, sampleTag); - assertThat(subscribers.apply(recommenderId, posterMid).size(), is(1)); + assertThat(subscribers.apply(recommenderId, messagesService.getMessage(posterMid)).size(), is(1)); messagesService.recommendMessage(posterMid, lateRecommenderId); - List lateRecommendSubscribers = subscribers.apply(recommenderId, posterMid); + List lateRecommendSubscribers = subscribers.apply(recommenderId, messagesService.getMessage(posterMid)); assertThat(lateRecommendSubscribers.size(), is(0)); + int readerMid = messagesService.createMessage(readerId, "PEOPLE", null, null); + messagesService.recommendMessage(readerMid, recommenderId); + assertThat(subscribers.apply(recommenderId, messagesService.getMessage(readerMid)).size(), is(0)); } } -- cgit v1.2.3