@Test public void handleEventIfProjectIsNull() { when(projectDAO.getProjectByFile(any(String.class))).thenReturn(null); this.handler.handleEvent(new DocumentInfo("", "", "", "", 0, 1)); verify(set, times(0)).addThread(any(Thread.class)); }
public void handleEvent(DocumentInfo info) { if (!settings.isSpywareEnabled()) { return; } Project project = projectDAO.getProjectByFile(info.getFullPath()); if (project == null) { return; } DocumentSendThread thread = new DocumentSendThread(receiver, info, project, documentCache, PATCH_GENERATOR); activeThreads.addThread(thread); thread.setDaemon(true); thread.start(); }
DocumentChangeHandler { public void handleEvent(DocumentInfo info) { if (!settings.isSpywareEnabled()) { return; } Project project = projectDAO.getProjectByFile(info.getFullPath()); if (project == null) { return; } DocumentSendThread thread = new DocumentSendThread(receiver, info, project, documentCache, PATCH_GENERATOR); activeThreads.addThread(thread); thread.setDaemon(true); thread.start(); } }
DocumentChangeHandler { public void handleEvent(DocumentInfo info) { if (!settings.isSpywareEnabled()) { return; } Project project = projectDAO.getProjectByFile(info.getFullPath()); if (project == null) { return; } DocumentSendThread thread = new DocumentSendThread(receiver, info, project, documentCache, PATCH_GENERATOR); activeThreads.addThread(thread); thread.setDaemon(true); thread.start(); } DocumentChangeHandler(EventReceiver receiver, ActiveThreadSet set, Settings settings, ProjectDAO projectDAO); }
DocumentChangeHandler { public void handleEvent(DocumentInfo info) { if (!settings.isSpywareEnabled()) { return; } Project project = projectDAO.getProjectByFile(info.getFullPath()); if (project == null) { return; } DocumentSendThread thread = new DocumentSendThread(receiver, info, project, documentCache, PATCH_GENERATOR); activeThreads.addThread(thread); thread.setDaemon(true); thread.start(); } DocumentChangeHandler(EventReceiver receiver, ActiveThreadSet set, Settings settings, ProjectDAO projectDAO); void handleEvent(DocumentInfo info); }
DocumentChangeHandler { public void handleEvent(DocumentInfo info) { if (!settings.isSpywareEnabled()) { return; } Project project = projectDAO.getProjectByFile(info.getFullPath()); if (project == null) { return; } DocumentSendThread thread = new DocumentSendThread(receiver, info, project, documentCache, PATCH_GENERATOR); activeThreads.addThread(thread); thread.setDaemon(true); thread.start(); } DocumentChangeHandler(EventReceiver receiver, ActiveThreadSet set, Settings settings, ProjectDAO projectDAO); void handleEvent(DocumentInfo info);  }