RepositoryApplicationService implements ApplicationService { @Override public List<ProjectApplication> getApplicationsOfUsers(Collection<User> users, Sort sort) { return applicationRepo.findAllByUserIn(users, sort); } @Autowired  RepositoryApplicationService(ProjectService projectService,
                                        ProjectApplicationRepository applicationRepo,
                                        ProjectApplicationEventHandler applicationEventHandler,
                                        Clock clock,
                                        ProjectBoardConfigurationProperties properties); @Override boolean userHasAppliedForProject(User user, Project project); @Override @Transactional ProjectApplication createApplicationForUser(User user, String projectId, String comment); @Override List<ProjectApplication> getApplicationsOfUser(User user, Sort sort); @Override List<ProjectApplication> getApplicationsOfUsers(Collection<User> users, Sort sort); @Transactional @Override ProjectApplication deleteApplication(User user, long applicationId);  }
@Test public void getApplicationsOfUsers() { var sort = Sort.unsorted(); var users = Set.of(userMock); var expectedApplication = new ProjectApplication(projectMock, "Comment", userMock, LocalDateTime.now(clock)); given(applicationRepoMock.findAllByUserIn(users, sort)).willReturn(Collections.singletonList(expectedApplication)); var actualApplications = applicationService.getApplicationsOfUsers(users, sort); assertThat(actualApplications).containsExactlyInAnyOrder(expectedApplication); verify(applicationRepoMock).findAllByUserIn(users, sort); }