IdeaService { public List<IdeaOut> fetchIdeasByCampaignAndCreator(String campaignId, UserEntity creator, UserEntity requestor) { Assert.notNull(campaignId, "campaignId must not be null"); Assert.notNull(creator, "creator must not be null"); return toIdeas(ideaRepository.findByCampaignIdAndCreator(campaignId, creator), requestor); }  IdeaOut fetchIdea(String ideaId, UserEntity requestor); Page<IdeaOut> fetchIdeasByStatus(String campaignId, Set<IdeaStatus> statusSet, Integer page, Integer pageSize, UserEntity requestor); Page<IdeaOut> fetchIdeasByRequestorHasVoted(String campaignId, boolean hasVoted, Integer page, Integer pageSize, UserEntity requestor); List<IdeaOut> fetchIdeasByCampaignAndCreator(String campaignId, UserEntity creator, UserEntity requestor); IdeaOut createNewIdea(String campaignId, IdeaIn cmd, UserEntity creator); IdeaOut modifyIdea(String ideaId, IdeaIn cmd, UserEntity requestingUser); void approveIdea(String campaignId, String ideaId, UserEntity approvingAdmin); void rejectIdea(String campaignId, String ideaId, String rejectionComment, UserEntity approvingAdmin); void voteForIdea(VoteCmd voteCmd, UserEntity voter);  }
@Test public void fetchIdeasByCampaignAndCreator_ShouldEnrichIdeas_ByRating() { final String campaignId = "test_campId"; final IdeaEntity expIdea = Fixtures.givenIdeaEntity("ideaId"); doReturn(singletonList(expIdea)).when(ideaRepository).findByCampaignIdAndCreator(eq(campaignId), eq(givenUserEntity("creatorId"))); final Rating expRating = givenVoteRepositoryReturnsVotes(expIdea.getId()); final List<IdeaOut> res = ideaService.fetchIdeasByCampaignAndCreator(campaignId, givenUserEntity("creatorId"), givenUserEntity("requestorId")); assertThat(res.get(0).getRating(), equalTo(expRating)); }