From 9e40587b3107d2aaae1d6afa88c426d0d3197776 Mon Sep 17 00:00:00 2001 From: Nicolas Quinquenel Date: Fri, 20 Sep 2024 15:39:41 +0200 Subject: [PATCH] Fix tests --- .../intellij/trigger/SonarLintCheckinHandlerTests.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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)); } }