use of org.sonarlint.intellij.messages.TaskListener in project sonarlint-intellij by SonarSource.
the class SonarLintTaskTest method testCallListenerOnError.
@Test
public void testCallListenerOnError() {
TaskListener listener = mock(TaskListener.class);
getProject().getMessageBus().connect(getProject()).subscribe(TaskListener.SONARLINT_TASK_TOPIC, listener);
doThrow(new IllegalStateException("error")).when(sonarLintAnalyzer).analyzeModule(eq(module), eq(files), any(IssueListener.class), any(ProgressMonitor.class));
task.run(progress);
// never called because of error
verifyZeroInteractions(processor);
// still called
verify(listener).ended(job);
verifyNoMoreInteractions(listener);
}
use of org.sonarlint.intellij.messages.TaskListener in project sonarlint-intellij by SonarSource.
the class SonarLintTaskTest method testTask.
@Test
public void testTask() {
TaskListener listener = mock(TaskListener.class);
getProject().getMessageBus().connect(getProject()).subscribe(TaskListener.SONARLINT_TASK_TOPIC, listener);
assertThat(task.shouldStartInBackground()).isTrue();
assertThat(task.isConditionalModal()).isFalse();
assertThat(task.getJob()).isEqualTo(job);
task.run(progress);
verify(sonarLintAnalyzer).analyzeModule(eq(module), eq(files), any(IssueListener.class), any(ProgressMonitor.class));
verify(processor).process(job, progress, new ArrayList<>(), new ArrayList<>());
verify(listener).ended(job);
verifyNoMoreInteractions(sonarLintAnalyzer);
verifyNoMoreInteractions(processor);
}
Aggregations