@Test public void retunsFailureAndCallsMethodsCorrectlyWhenCancelRequestedAfterHandlingResponse() throws IOException { when(progress.isCancelRequested()).thenReturn(false); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { when(progress.isCancelRequested()).thenReturn(true); return null; } }).when(uploader).handleSubmissionResponse(); assertEquals(BackgroundTask.RETURN_INTERRUPTED, task.start(progress)); verify(progress, times(1)).incrementProgress(1); verify(uploader, times(1)).zipProjects(); verify(uploader, times(1)).handleSubmissionResponse(); verify(uploader, times(0)).handleSubmissionResult(Mockito.any(StopStatus.class)); }
@Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), 3); return run(progress); }
UploaderTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), 3); return run(progress); } }
UploaderTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), 3); return run(progress); } UploaderTask(ProjectUploader uploader, String path, ProjectDAO projectDAO, IdeUIInvoker invoker); }
UploaderTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), 3); return run(progress); } UploaderTask(ProjectUploader uploader, String path, ProjectDAO projectDAO, IdeUIInvoker invoker); @Override int start(TaskStatusMonitor progress); SubmissionResult getResult(); Project getProject(); }
UploaderTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), 3); return run(progress); } UploaderTask(ProjectUploader uploader, String path, ProjectDAO projectDAO, IdeUIInvoker invoker); @Override int start(TaskStatusMonitor progress); SubmissionResult getResult(); Project getProject();  }