diff --git a/src/test/java/org/sonarlint/intellij/trigger/SonarLintCheckinHandlerTests.java b/src/test/java/org/sonarlint/intellij/trigger/SonarLintCheckinHandlerTests.java index 9d776397d..154b1ceed 100644 --- a/src/test/java/org/sonarlint/intellij/trigger/SonarLintCheckinHandlerTests.java +++ b/src/test/java/org/sonarlint/intellij/trigger/SonarLintCheckinHandlerTests.java @@ -47,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @@ -88,7 +89,7 @@ void testNoUnresolvedIssues() { var result = handler.beforeCheckin(null, null); assertThat(result).isEqualTo(CheckinHandler.ReturnResult.COMMIT); - verify(analysisSubmitter).analyzeFilesPreCommit(Collections.singleton(file)); + verify(analysisSubmitter, timeout(1000)).analyzeFilesPreCommit(Collections.singleton(file)); verifyNoInteractions(toolWindow); } @@ -120,7 +121,7 @@ void testIssues() { verify(toolWindow).openReportTab(analysisResultCaptor.capture()); var analysisResult = analysisResultCaptor.getValue(); assertThat(analysisResult.getFindings().getIssuesPerFile()).containsEntry(file, Set.of(issue)); - verify(analysisSubmitter).analyzeFilesPreCommit(Collections.singleton(file)); + verify(analysisSubmitter, timeout(1000)).analyzeFilesPreCommit(Collections.singleton(file)); } @@ -154,6 +155,6 @@ void testSecretsIssues() { verify(toolWindow).openReportTab(analysisResultCaptor.capture()); var analysisResult = analysisResultCaptor.getValue(); assertThat(analysisResult.getFindings().getIssuesPerFile()).containsEntry(file, Set.of(issue)); - verify(analysisSubmitter).analyzeFilesPreCommit(Collections.singleton(file)); + verify(analysisSubmitter, timeout(1000)).analyzeFilesPreCommit(Collections.singleton(file)); } }