@Test public void updateProjectHasNoInteractionsIfStatusIsDeleted() { Project project = mock(Project.class); when(project.getStatus()).thenReturn(ProjectStatus.DELETED); scanner.updateProject(project); verify(project, times(1)).getStatus(); verifyNoMoreInteractions(dao); verifyNoMoreInteractions(project); }
public void updateProject(Project project) { if (project.getStatus() == ProjectStatus.DELETED) { return; } List<String> files = new ArrayList<String>(); traverse(files, io.newFile(project.getRootPath())); project.setProjectFiles(files); if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } }
ProjectScanner { public void updateProject(Project project) { if (project.getStatus() == ProjectStatus.DELETED) { return; } List<String> files = new ArrayList<String>(); traverse(files, io.newFile(project.getRootPath())); project.setProjectFiles(files); if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } }
ProjectScanner { public void updateProject(Project project) { if (project.getStatus() == ProjectStatus.DELETED) { return; } List<String> files = new ArrayList<String>(); traverse(files, io.newFile(project.getRootPath())); project.setProjectFiles(files); if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } ProjectScanner(ProjectDAO projectDAO, IOFactory io); }
ProjectScanner { public void updateProject(Project project) { if (project.getStatus() == ProjectStatus.DELETED) { return; } List<String> files = new ArrayList<String>(); traverse(files, io.newFile(project.getRootPath())); project.setProjectFiles(files); if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } ProjectScanner(ProjectDAO projectDAO, IOFactory io); void updateProject(Project project); void updateProjects(); }
ProjectScanner { public void updateProject(Project project) { if (project.getStatus() == ProjectStatus.DELETED) { return; } List<String> files = new ArrayList<String>(); traverse(files, io.newFile(project.getRootPath())); project.setProjectFiles(files); if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } ProjectScanner(ProjectDAO projectDAO, IOFactory io); void updateProject(Project project); void updateProjects();  }