@Test public void getProjectByIdReturnsProjectForExistingProjectForId() { given(projectRepo.findById(PROJECT_ID)).willReturn(Optional.of(projectMock)); Project actualProject = projectService.getProjectById(PROJECT_ID); assertThat(actualProject).isEqualTo(projectMock); }
@Override @Transactional(readOnly = true) public Project getProjectById(String projectId) throws ProjectNotFoundException { Optional<Project> projectOptional = projectRepo.findById(projectId); return projectOptional.orElseThrow(ProjectNotFoundException::new); }
RepositoryProjectService implements ProjectService { @Override @Transactional(readOnly = true) public Project getProjectById(String projectId) throws ProjectNotFoundException { Optional<Project> projectOptional = projectRepo.findById(projectId); return projectOptional.orElseThrow(ProjectNotFoundException::new); } }
RepositoryProjectService implements ProjectService { @Override @Transactional(readOnly = true) public Project getProjectById(String projectId) throws ProjectNotFoundException { Optional<Project> projectOptional = projectRepo.findById(projectId); return projectOptional.orElseThrow(ProjectNotFoundException::new); } @Autowired  RepositoryProjectService(ProjectRepository projectRepo,
                                    ProjectApplicationRepository applicationRepo,
                                    UserRepository userRepo,
                                    UserService userService,
                                    Clock clock); }
RepositoryProjectService implements ProjectService { @Override @Transactional(readOnly = true) public Project getProjectById(String projectId) throws ProjectNotFoundException { Optional<Project> projectOptional = projectRepo.findById(projectId); return projectOptional.orElseThrow(ProjectNotFoundException::new); } @Autowired  RepositoryProjectService(ProjectRepository projectRepo,
                                    ProjectApplicationRepository applicationRepo,
                                    UserRepository userRepo,
                                    UserService userService,
                                    Clock clock); @Override @Transactional(readOnly = true) Project getProjectById(String projectId); @Override @Transactional(readOnly = true) boolean projectExists(String projectId); @Override Project save(Project project); @Override List<Project> saveAll(List<Project> projects); @Override Project createProject(Project project); }
RepositoryProjectService implements ProjectService { @Override @Transactional(readOnly = true) public Project getProjectById(String projectId) throws ProjectNotFoundException { Optional<Project> projectOptional = projectRepo.findById(projectId); return projectOptional.orElseThrow(ProjectNotFoundException::new); } @Autowired  RepositoryProjectService(ProjectRepository projectRepo,
                                    ProjectApplicationRepository applicationRepo,
                                    UserRepository userRepo,
                                    UserService userService,
                                    Clock clock); @Override @Transactional(readOnly = true) Project getProjectById(String projectId); @Override @Transactional(readOnly = true) boolean projectExists(String projectId); @Override Project save(Project project); @Override List<Project> saveAll(List<Project> projects); @Override Project createProject(Project project);  }