RepositoryApplicationService implements ApplicationService { @Override public List<ProjectApplication> getApplicationsOfUser(User user, Sort sort) { return applicationRepo.findAllByUser(user, 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 getApplicationsOfUser() { var sort = Sort.unsorted(); var firstApplicationMock = mock(ProjectApplication.class); var secondApplicationMock = mock(ProjectApplication.class); var expectedApplications = List.of(firstApplicationMock, secondApplicationMock); given(applicationRepoMock.findAllByUser(userMock, sort)).willReturn(expectedApplications); var actualApplications = applicationService.getApplicationsOfUser(userMock, sort); assertThat(actualApplications).containsExactlyInAnyOrder(firstApplicationMock, secondApplicationMock); }