@Test public void userHasAppliedForProjectReturnsTrueWhenApplicationIsPresent() { given(applicationRepoMock.existsByUserAndProject(userMock, projectMock)).willReturn(true); boolean actualApplied = applicationService.userHasAppliedForProject(userMock, projectMock); assertThat(actualApplied).isTrue(); }
@Override public boolean userHasAppliedForProject(User user, Project project) { return applicationRepo.existsByUserAndProject(user, project); }
RepositoryApplicationService implements ApplicationService { @Override public boolean userHasAppliedForProject(User user, Project project) { return applicationRepo.existsByUserAndProject(user, project); } }
RepositoryApplicationService implements ApplicationService { @Override public boolean userHasAppliedForProject(User user, Project project) { return applicationRepo.existsByUserAndProject(user, project); } @Autowired  RepositoryApplicationService(ProjectService projectService,
                                        ProjectApplicationRepository applicationRepo,
                                        ProjectApplicationEventHandler applicationEventHandler,
                                        Clock clock,
                                        ProjectBoardConfigurationProperties properties); }
RepositoryApplicationService implements ApplicationService { @Override public boolean userHasAppliedForProject(User user, Project project) { return applicationRepo.existsByUserAndProject(user, project); } @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); }
RepositoryApplicationService implements ApplicationService { @Override public boolean userHasAppliedForProject(User user, Project project) { return applicationRepo.existsByUserAndProject(user, project); } @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);  }