@Test public void fileIsNotRenamedWhenProjectNotInDAO() { SnapshotInfo snapshot = new SnapshotInfo("project2", "", "", INVALID_NEW_FILE, INVALID_NEW_FILE + "bar", ChangeType.FILE_RENAME); handler.handleSnapshot(snapshot); verifyProjectTypeInteractionWhenFileNotInProject(INVALID_NEW_FILE); verifyNoMoreInteractions(project); }
public void handleSnapshot(SnapshotInfo snapshot) { Project project = findProject(snapshot); if (project == null) { return; } switch (snapshot.getChangeType()) { case FILE_CREATE: case FOLDER_CREATE: handleCreate(project, snapshot); break; case FILE_DELETE: handleFileDelete(project, snapshot); break; case FOLDER_DELETE: handleFolderDelete(project, snapshot); break; case FILE_RENAME: handleFileRename(project, snapshot); break; case FOLDER_RENAME: handleFolderRename(project, snapshot); break; default: break; } if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } }
ProjectEventHandler { public void handleSnapshot(SnapshotInfo snapshot) { Project project = findProject(snapshot); if (project == null) { return; } switch (snapshot.getChangeType()) { case FILE_CREATE: case FOLDER_CREATE: handleCreate(project, snapshot); break; case FILE_DELETE: handleFileDelete(project, snapshot); break; case FOLDER_DELETE: handleFolderDelete(project, snapshot); break; case FILE_RENAME: handleFileRename(project, snapshot); break; case FOLDER_RENAME: handleFolderRename(project, snapshot); break; default: break; } if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } }
ProjectEventHandler { public void handleSnapshot(SnapshotInfo snapshot) { Project project = findProject(snapshot); if (project == null) { return; } switch (snapshot.getChangeType()) { case FILE_CREATE: case FOLDER_CREATE: handleCreate(project, snapshot); break; case FILE_DELETE: handleFileDelete(project, snapshot); break; case FOLDER_DELETE: handleFolderDelete(project, snapshot); break; case FILE_RENAME: handleFileRename(project, snapshot); break; case FOLDER_RENAME: handleFolderRename(project, snapshot); break; default: break; } if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } ProjectEventHandler(ProjectDAO projectDAO); }
ProjectEventHandler { public void handleSnapshot(SnapshotInfo snapshot) { Project project = findProject(snapshot); if (project == null) { return; } switch (snapshot.getChangeType()) { case FILE_CREATE: case FOLDER_CREATE: handleCreate(project, snapshot); break; case FILE_DELETE: handleFileDelete(project, snapshot); break; case FOLDER_DELETE: handleFolderDelete(project, snapshot); break; case FILE_RENAME: handleFileRename(project, snapshot); break; case FOLDER_RENAME: handleFolderRename(project, snapshot); break; default: break; } if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } ProjectEventHandler(ProjectDAO projectDAO); void handleDeletion(String projectPath); void handleSnapshot(SnapshotInfo snapshot); }
ProjectEventHandler { public void handleSnapshot(SnapshotInfo snapshot) { Project project = findProject(snapshot); if (project == null) { return; } switch (snapshot.getChangeType()) { case FILE_CREATE: case FOLDER_CREATE: handleCreate(project, snapshot); break; case FILE_DELETE: handleFileDelete(project, snapshot); break; case FOLDER_DELETE: handleFolderDelete(project, snapshot); break; case FILE_RENAME: handleFileRename(project, snapshot); break; case FOLDER_RENAME: handleFolderRename(project, snapshot); break; default: break; } if (project.existsOnDisk()) { project.setStatus(ProjectStatus.DOWNLOADED); } else { project.setStatus(ProjectStatus.NOT_DOWNLOADED); } } ProjectEventHandler(ProjectDAO projectDAO); void handleDeletion(String projectPath); void handleSnapshot(SnapshotInfo snapshot);  }