@Test public void shouldListProjects() { String projectName = "project1"; Project project = new Project(projectName); List<Project> expected = Arrays.asList(project); when(projectRepository.findAllByArchivedIsFalse()).thenReturn(expected); List<Project> actual = projectService.listProjects(); Assert.assertEquals(expected, actual); }
@Transactional public List<Project> listProjects() { return projectRepository.findAllByArchivedIsFalse(); }
ProjectService { @Transactional public List<Project> listProjects() { return projectRepository.findAllByArchivedIsFalse(); } }
ProjectService { @Transactional public List<Project> listProjects() { return projectRepository.findAllByArchivedIsFalse(); } @Autowired  ProjectService(ProjectRepository projectRepository); }
ProjectService { @Transactional public List<Project> listProjects() { return projectRepository.findAllByArchivedIsFalse(); } @Autowired  ProjectService(ProjectRepository projectRepository); @Transactional void createProject(String name); @Transactional void archiveProject(String name); @Transactional List<Project> listProjects(); }
ProjectService { @Transactional public List<Project> listProjects() { return projectRepository.findAllByArchivedIsFalse(); } @Autowired  ProjectService(ProjectRepository projectRepository); @Transactional void createProject(String name); @Transactional void archiveProject(String name); @Transactional List<Project> listProjects();  }