From 12939729652fad6fa91b72c2139da65dc07ec7e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9o=20Geoffroy?= <99647462+leo-geoffroy-sonarsource@users.noreply.github.com> Date: Mon, 4 Apr 2022 18:08:34 +0200 Subject: [PATCH] NO-JIRA Update Mockito and simpleframework to latest major version --- build.gradle | 4 +-- .../auth/ldap/LdapAutodiscoveryTest.java | 2 +- ...eIssuesOnRemovedComponentsVisitorTest.java | 8 ++--- .../issue/ClosedIssuesInputFactoryTest.java | 10 +++---- .../issue/ComponentIssuesLoaderTest.java | 6 ++-- .../IssueCreationDateCalculatorTest.java | 4 +-- ...onentUuidsHavingOpenIssuesVisitorTest.java | 4 +-- .../issue/MovedIssueVisitorTest.java | 4 +-- .../commonrule/CommonRuleEngineImplTest.java | 6 ++-- .../measure/MeasureRepositoryImplTest.java | 6 ++-- ...nalysisFailureNotificationHandlerTest.java | 10 +++---- .../scm/ScmInfoRepositoryImplTest.java | 30 +++++++++---------- .../source/FileSourceDataWarningsTest.java | 22 +++++++------- .../source/LineReadersImplTest.java | 6 ++-- .../SourceLinesHashRepositoryImplTest.java | 12 ++++---- ...ProjectDuplicationsRepositoryStepTest.java | 3 +- .../step/PersistProjectLinksStepTest.java | 4 +-- .../step/QualityGateEventsStepTest.java | 4 +-- .../step/SendIssueNotificationsStepTest.java | 4 +-- .../step/TriggerViewRefreshStepTest.java | 6 ++-- .../file/ExportLineHashesStepTest.java | 2 +- .../ce/task/log/CeTaskMessagesImplTest.java | 4 +-- .../DistributedCEQueueStatusImplTest.java | 4 +-- ...lureNotificationExecutionListenerTest.java | 14 ++++----- .../platform/DatabaseCompatibilityTest.java | 4 +-- .../ce/queue/CeQueueInitializerTest.java | 4 +-- .../ce/queue/InternalCeQueueImplTest.java | 4 +-- .../ce/taskprocessor/CeWorkerImplTest.java | 10 +++---- .../SimpleCeTaskInterrupterTest.java | 6 ++-- .../java/org/sonar/db/purge/PurgeDaoTest.java | 8 ++--- .../charset/OracleCharsetHandlerTest.java | 6 ++-- .../charset/PostgresCharsetHandlerTest.java | 4 +-- .../engine/MigrationEngineImplTest.java | 1 - .../NoTableMigrationHistoryImplTest.java | 4 +-- .../application/AppReloaderImplTest.java | 14 ++++----- .../health/HealthStateRefresherTest.java | 4 +-- .../TopAggregationHelperTest.java | 4 +-- ...angesOnMyIssueNotificationHandlerTest.java | 12 ++++---- .../FPOrWontFixNotificationHandlerTest.java | 16 +++++----- .../MyNewIssuesNotificationHandlerTest.java | 12 ++++---- .../NewIssuesNotificationHandlerTest.java | 10 +++---- .../notification/NotificationServiceTest.java | 10 +++---- .../QGChangeNotificationHandlerTest.java | 10 +++---- .../QGChangeEventListenersImplTest.java | 8 ++--- .../BasicAuthenticationTest.java | 14 ++++----- ...CredentialsExternalAuthenticationTest.java | 8 ++--- .../HttpHeadersAuthenticationTest.java | 12 ++++---- .../server/authentication/InitFilterTest.java | 20 ++++++------- .../OAuth2CallbackFilterTest.java | 8 ++--- .../event/AuthenticationEventImplTest.java | 10 +++---- .../email/EmailNotificationChannelTest.java | 4 +-- .../db/migration/AutoDbMigrationTest.java | 6 ++-- .../WebhookQGChangeEventListenerTest.java | 8 ++--- .../authentication/ws/LoginActionTest.java | 12 ++++---- .../server/branch/pr/ws/DeleteActionTest.java | 2 +- .../server/ce/ws/CancelAllActionTest.java | 4 +-- .../sonar/server/issue/CommentActionTest.java | 4 +-- .../server/issue/ws/IssueUpdaterTest.java | 6 ++-- .../server/platform/ws/IndexActionTest.java | 4 +-- .../plugins/ws/InstalledActionTest.java | 6 ++-- .../qualityprofile/QProfileCopierTest.java | 4 +-- .../QProfileFactoryImplTest.java | 4 +-- ...gisterQualityProfilesNotificationTest.java | 3 +- ...uiltInQPChangeNotificationHandlerTest.java | 10 +++---- ...ltInQualityProfilesUpdateListenerTest.java | 4 +-- .../sonar/server/app/NullJarScannerTest.java | 4 +-- .../sonar/server/app/TomcatAccessLogTest.java | 4 +-- .../platform/web/CacheControlFilterTest.java | 6 ++-- .../platform/web/RedirectFilterTest.java | 6 ++-- .../platform/web/WebPagesFilterTest.java | 4 +-- .../sonar/core/i18n/DurationLabelTest.java | 2 +- .../core/platform/ComponentKeysTest.java | 4 +-- .../core/util/DefaultHttpDownloaderTest.java | 9 +++--- .../token/BlackHoleTokenChannelTest.java | 4 +-- .../duplications/token/TokenChannelTest.java | 4 +-- .../cpd/internal/DefaultCpdTokensTest.java | 9 +++--- .../api/utils/log/ConsoleLoggerTest.java | 6 ++-- .../cpd/JavaCpdBlockIndexerSensorTest.java | 4 +-- .../scanner/issue/IssuePublisherTest.java | 12 ++++---- .../phases/ModuleSensorsExecutorTest.java | 4 +-- .../AnalysisContextReportPublisherTest.java | 4 +-- .../report/ChangedLinesPublisherTest.java | 10 +++---- .../scm/ScmChangedFilesProviderTest.java | 4 +-- .../sensor/DefaultSensorStorageTest.java | 4 +-- .../sonar/scm/git/JGitBlameCommandTest.java | 8 ++--- 85 files changed, 296 insertions(+), 299 deletions(-) diff --git a/build.gradle b/build.gradle index 5ed5d540aba..72ada93f85d 100644 --- a/build.gradle +++ b/build.gradle @@ -300,7 +300,7 @@ subprojects { dependency 'org.hamcrest:hamcrest-all:1.3' dependency 'org.jsoup:jsoup:1.14.3' dependency 'org.mindrot:jbcrypt:0.4' - dependency('org.mockito:mockito-core:3.12.4') { + dependency('org.mockito:mockito-core:4.4.0') { exclude 'org.hamcrest:hamcrest-core' } dependency 'org.mybatis:mybatis:3.5.9' @@ -313,7 +313,7 @@ subprojects { } dependency 'org.postgresql:postgresql:42.3.3' dependency 'org.reflections:reflections:0.10.2' - dependency 'org.simpleframework:simple:4.1.21' + dependency 'org.simpleframework:simple:5.1.6' dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.37.0.87' dependency 'org.sonarsource.update-center:sonar-update-center-common:1.23.0.723' dependency('org.springframework:spring-context:5.3.18') { diff --git a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java index 50e841771dd..276075a8b60 100644 --- a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java +++ b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java @@ -73,7 +73,7 @@ public class LdapAutodiscoveryTest { Attribute attribute = mock(Attribute.class); NamingEnumeration namingEnumeration = mock(NamingEnumeration.class); - when(context.getAttributes(Mockito.anyString(), Mockito.anyObject())).thenReturn(attributes); + when(context.getAttributes(Mockito.anyString(), Mockito.any())).thenReturn(attributes); when(attributes.get("srv")).thenReturn(attribute); when(attribute.getAll()).thenReturn(namingEnumeration); when(namingEnumeration.hasMore()).thenReturn(true, true, true, true, true, false); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitorTest.java index f5880143bd0..8017b4f99db 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitorTest.java @@ -38,7 +38,7 @@ import static com.google.common.collect.Sets.newHashSet; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.task.projectanalysis.component.Component.Type.DIRECTORY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; @@ -90,7 +90,7 @@ public class CloseIssuesOnRemovedComponentsVisitorTest { underTest.visit(ReportComponent.builder(PROJECT, 1).build()); - verifyZeroInteractions(issueLifecycle); + verifyNoInteractions(issueLifecycle); CloseableIterator issues = protoIssueCache.traverse(); assertThat(issues.hasNext()).isFalse(); } @@ -99,7 +99,7 @@ public class CloseIssuesOnRemovedComponentsVisitorTest { public void do_nothing_on_directory() { underTest.visit(ReportComponent.builder(DIRECTORY, 1).build()); - verifyZeroInteractions(issueLifecycle); + verifyNoInteractions(issueLifecycle); CloseableIterator issues = protoIssueCache.traverse(); assertThat(issues.hasNext()).isFalse(); } @@ -108,7 +108,7 @@ public class CloseIssuesOnRemovedComponentsVisitorTest { public void do_nothing_on_file() { underTest.visit(ReportComponent.builder(FILE, 1).build()); - verifyZeroInteractions(issueLifecycle); + verifyNoInteractions(issueLifecycle); CloseableIterator issues = protoIssueCache.traverse(); assertThat(issues.hasNext()).isFalse(); } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ClosedIssuesInputFactoryTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ClosedIssuesInputFactoryTest.java index efac6c783a3..62ce9c27439 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ClosedIssuesInputFactoryTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ClosedIssuesInputFactoryTest.java @@ -34,7 +34,7 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class ClosedIssuesInputFactoryTest { @@ -51,7 +51,7 @@ public class ClosedIssuesInputFactoryTest { Input input = underTest.create(component); - verifyZeroInteractions(dbClient, issuesLoader); + verifyNoInteractions(dbClient, issuesLoader); List issues = ImmutableList.of(new DefaultIssue(), new DefaultIssue()); when(issuesLoader.loadClosedIssues(componentUuid)).thenReturn(issues); @@ -69,7 +69,7 @@ public class ClosedIssuesInputFactoryTest { Input input = underTest.create(component); - verifyZeroInteractions(dbClient, issuesLoader); + verifyNoInteractions(dbClient, issuesLoader); List issues = ImmutableList.of(); when(issuesLoader.loadClosedIssues(originalComponentUuid)).thenReturn(issues); @@ -85,7 +85,7 @@ public class ClosedIssuesInputFactoryTest { Input input = underTest.create(component); - verifyZeroInteractions(dbClient, issuesLoader); + verifyNoInteractions(dbClient, issuesLoader); List issues = ImmutableList.of(new DefaultIssue()); when(issuesLoader.loadClosedIssues(componentUuid)).thenReturn(issues); @@ -95,6 +95,6 @@ public class ClosedIssuesInputFactoryTest { reset(issuesLoader); assertThat(input.getIssues()).isSameAs(issues); - verifyZeroInteractions(issuesLoader); + verifyNoInteractions(issuesLoader); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoaderTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoaderTest.java index bcbf18849c4..193433a31e3 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoaderTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoaderTest.java @@ -51,7 +51,7 @@ import static java.util.Collections.emptyList; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.api.issue.Issue.STATUS_CLOSED; import static org.sonar.api.rules.RuleType.CODE_SMELL; @@ -215,7 +215,7 @@ public class ComponentIssuesLoaderTest { assertThat(underTest.loadClosedIssues(componentUuid)).isEmpty(); - verifyZeroInteractions(dbClient, system2); + verifyNoInteractions(dbClient, system2); } @Test @@ -226,7 +226,7 @@ public class ComponentIssuesLoaderTest { underTest.loadLatestDiffChangesForReopeningOfClosedIssues(emptyList()); - verifyZeroInteractions(dbClient, system2); + verifyNoInteractions(dbClient, system2); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCreationDateCalculatorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCreationDateCalculatorTest.java index 3c08e193e57..6d95de1cc67 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCreationDateCalculatorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCreationDateCalculatorTest.java @@ -61,7 +61,7 @@ import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.task.projectanalysis.qualityprofile.QProfileStatusRepository.Status.UNCHANGED; @@ -317,7 +317,7 @@ public class IssueCreationDateCalculatorTest { run(); assertChangeOfCreationDateTo(expectedDate); - verifyZeroInteractions(activeRulesHolder); + verifyNoInteractions(activeRulesHolder); } @DataProvider diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/LoadComponentUuidsHavingOpenIssuesVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/LoadComponentUuidsHavingOpenIssuesVisitorTest.java index 083d7fc2bc2..60c76ae8985 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/LoadComponentUuidsHavingOpenIssuesVisitorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/LoadComponentUuidsHavingOpenIssuesVisitorTest.java @@ -27,7 +27,7 @@ import org.sonar.ce.task.projectanalysis.component.VisitorsCrawler; import static com.google.common.collect.Sets.newHashSet; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.task.projectanalysis.component.Component.Type.DIRECTORY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; @@ -55,6 +55,6 @@ public class LoadComponentUuidsHavingOpenIssuesVisitorTest { underTest.visit(ReportComponent.builder(DIRECTORY, 1).build()); underTest.visit(ReportComponent.builder(FILE, 1).build()); - verifyZeroInteractions(componentsWithUnprocessedIssues); + verifyNoInteractions(componentsWithUnprocessedIssues); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java index 88e38898e02..968db8e4443 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java @@ -38,8 +38,8 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class MovedIssueVisitorTest { @@ -69,7 +69,7 @@ public class MovedIssueVisitorTest { DefaultIssue issue = mock(DefaultIssue.class); underTest.onIssue(ReportComponent.builder(Component.Type.DIRECTORY, 1).build(), issue); - verifyZeroInteractions(issue); + verifyNoInteractions(issue); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImplTest.java index b2751986ce1..6d69ef99d89 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImplTest.java @@ -28,7 +28,7 @@ import org.sonar.core.issue.DefaultIssue; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.task.projectanalysis.component.ReportComponent.DUMB_PROJECT; @@ -62,7 +62,7 @@ public class CommonRuleEngineImplTest { Collection issues = underTest.process(file); assertThat(issues).isEmpty(); - verifyZeroInteractions(rule1, rule2); + verifyNoInteractions(rule1, rule2); } @Test @@ -70,6 +70,6 @@ public class CommonRuleEngineImplTest { Collection issues = underTest.process(DUMB_PROJECT); assertThat(issues).isEmpty(); - verifyZeroInteractions(rule1, rule2); + verifyNoInteractions(rule1, rule2); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java index 41c0d823445..84a447cb6b7 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java @@ -57,8 +57,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.db.component.ComponentTesting.newFileDto; @@ -115,7 +115,7 @@ public class MeasureRepositoryImplTest { underTestWithMock.getBaseMeasure(null, metric1); fail("an NPE should have been raised"); } catch (NullPointerException e) { - verifyZeroInteractions(mockedDbClient); + verifyNoInteractions(mockedDbClient); } } @@ -125,7 +125,7 @@ public class MeasureRepositoryImplTest { underTestWithMock.getBaseMeasure(FILE_COMPONENT, null); fail("an NPE should have been raised"); } catch (NullPointerException e) { - verifyZeroInteractions(mockedDbClient); + verifyNoInteractions(mockedDbClient); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationHandlerTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationHandlerTest.java index e0571fe8d0c..55520fe18ce 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationHandlerTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationHandlerTest.java @@ -42,8 +42,8 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION; import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; @@ -92,7 +92,7 @@ public class ReportAnalysisFailureNotificationHandlerTest { int deliver = underTest.deliver(Collections.emptyList()); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager, emailNotificationChannel); + verifyNoInteractions(notificationManager, emailNotificationChannel); } @Test @@ -105,10 +105,10 @@ public class ReportAnalysisFailureNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -121,7 +121,7 @@ public class ReportAnalysisFailureNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); notifications.forEach(notification -> { diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImplTest.java index 9faf3d25046..16c69b83a34 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImplTest.java @@ -52,8 +52,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.api.utils.log.LoggerLevel.TRACE; import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder; @@ -105,9 +105,9 @@ public class ScmInfoRepositoryImplTest { underTest.getScmInfo(FILE); assertThat(logTester.logs(TRACE)).isEmpty(); - verifyZeroInteractions(dbLoader); - verifyZeroInteractions(sourceHashRepository); - verifyZeroInteractions(diff); + verifyNoInteractions(dbLoader); + verifyNoInteractions(sourceHashRepository); + verifyNoInteractions(diff); } @Test @@ -124,9 +124,9 @@ public class ScmInfoRepositoryImplTest { assertThat(logTester.logs(TRACE)).containsOnly("Reading SCM info from report for file 'FILE_KEY'"); - verifyZeroInteractions(dbLoader); - verifyZeroInteractions(sourceHashRepository); - verifyZeroInteractions(diff); + verifyNoInteractions(dbLoader); + verifyNoInteractions(sourceHashRepository); + verifyNoInteractions(diff); } @Test @@ -144,7 +144,7 @@ public class ScmInfoRepositoryImplTest { verifyNoMoreInteractions(dbLoader); verifyNoMoreInteractions(sourceHashRepository); - verifyZeroInteractions(diff); + verifyNoInteractions(diff); } @Test @@ -163,7 +163,7 @@ public class ScmInfoRepositoryImplTest { verifyNoMoreInteractions(dbLoader); verifyNoMoreInteractions(sourceHashRepository); - verifyZeroInteractions(diff); + verifyNoInteractions(diff); } @Test @@ -178,8 +178,8 @@ public class ScmInfoRepositoryImplTest { verify(dbLoader).getScmInfo(FILE); verifyNoMoreInteractions(dbLoader); - verifyZeroInteractions(sourceHashRepository); - verifyZeroInteractions(diff); + verifyNoInteractions(sourceHashRepository); + verifyNoInteractions(diff); } @Test @@ -195,8 +195,8 @@ public class ScmInfoRepositoryImplTest { verify(dbLoader).getScmInfo(FILE); verifyNoMoreInteractions(dbLoader); - verifyZeroInteractions(sourceHashRepository); - verifyZeroInteractions(diff); + verifyNoInteractions(sourceHashRepository); + verifyNoInteractions(diff); } @Test @@ -214,7 +214,7 @@ public class ScmInfoRepositoryImplTest { verify(dbLoader).getScmInfo(FILE); verify(diff).computeMatchingLines(FILE); verifyNoMoreInteractions(dbLoader); - verifyZeroInteractions(sourceHashRepository); + verifyNoInteractions(sourceHashRepository); verifyNoMoreInteractions(diff); } @@ -233,7 +233,7 @@ public class ScmInfoRepositoryImplTest { assertThat(underTest.getScmInfo(component)).isEmpty(); - verifyZeroInteractions(batchReportReader, dbLoader); + verifyNoInteractions(batchReportReader, dbLoader); } @DataProvider diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/FileSourceDataWarningsTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/FileSourceDataWarningsTest.java index 4b3a4369038..996ef8f8c2b 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/FileSourceDataWarningsTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/FileSourceDataWarningsTest.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.task.projectanalysis.source.linereader.LineReader.Data.HIGHLIGHTING; import static org.sonar.ce.task.projectanalysis.source.linereader.LineReader.Data.SYMBOLS; @@ -103,7 +103,7 @@ public class FileSourceDataWarningsTest { underTest.addWarning(file, readError); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -125,7 +125,7 @@ public class FileSourceDataWarningsTest { Arrays.stream(readErrors).forEach(readError -> underTest.addWarning(file, readError)); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -148,7 +148,7 @@ public class FileSourceDataWarningsTest { Arrays.stream(files).forEach(file -> IntStream.range(0, 1 + random.nextInt(10)) .forEach(i -> underTest.addWarning(file, new LineReader.ReadError(HIGHLIGHTING, line + i)))); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -173,7 +173,7 @@ public class FileSourceDataWarningsTest { Arrays.stream(files).forEach(file -> IntStream.range(0, 1 + random.nextInt(10)) .forEach(i -> underTest.addWarning(file, new LineReader.ReadError(HIGHLIGHTING, line + i)))); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -195,7 +195,7 @@ public class FileSourceDataWarningsTest { underTest.addWarning(file, readError); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -217,7 +217,7 @@ public class FileSourceDataWarningsTest { Arrays.stream(readErrors).forEach(readError -> underTest.addWarning(file, readError)); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -240,7 +240,7 @@ public class FileSourceDataWarningsTest { Arrays.stream(files).forEach(file -> IntStream.range(0, 1 + random.nextInt(10)) .forEach(i -> underTest.addWarning(file, new LineReader.ReadError(SYMBOLS, line + i)))); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -265,7 +265,7 @@ public class FileSourceDataWarningsTest { Arrays.stream(files).forEach(file -> IntStream.range(0, 1 + random.nextInt(10)) .forEach(i -> underTest.addWarning(file, new LineReader.ReadError(SYMBOLS, line + i)))); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); @@ -288,11 +288,11 @@ public class FileSourceDataWarningsTest { underTest.addWarning(file, readError); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); underTest.commitWarnings(); - verifyZeroInteractions(taskMessages); + verifyNoInteractions(taskMessages); } @DataProvider diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/LineReadersImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/LineReadersImplTest.java index 1de96a53e47..14dd900d84a 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/LineReadersImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/LineReadersImplTest.java @@ -41,8 +41,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class LineReadersImplTest { @@ -62,7 +62,7 @@ public class LineReadersImplTest { verify(c1).close(); verify(c2).close(); verifyNoMoreInteractions(c1, c2); - verifyZeroInteractions(r1, r2); + verifyNoInteractions(r1, r2); } @Test @@ -79,7 +79,7 @@ public class LineReadersImplTest { verify(r1).read(builder); verify(r2).read(builder); verifyNoMoreInteractions(r1, r2); - verifyZeroInteractions(c1, c2); + verifyNoInteractions(c1, c2); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepositoryImplTest.java index d6defe33b3f..42b85f092ee 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepositoryImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepositoryImplTest.java @@ -40,8 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class SourceLinesHashRepositoryImplTest { @@ -73,7 +73,7 @@ public class SourceLinesHashRepositoryImplTest { verify(significantCodeRepository).getRangesPerLine(file); verifyNoMoreInteractions(significantCodeRepository); - verifyZeroInteractions(dbLineHashVersion); + verifyNoInteractions(dbLineHashVersion); } @Test @@ -83,7 +83,7 @@ public class SourceLinesHashRepositoryImplTest { verify(significantCodeRepository).getRangesPerLine(file); verifyNoMoreInteractions(significantCodeRepository); - verifyZeroInteractions(dbLineHashVersion); + verifyNoInteractions(dbLineHashVersion); } @Test @@ -94,7 +94,7 @@ public class SourceLinesHashRepositoryImplTest { assertLineHashes(lineHashes, "line1", "line2", "line3"); verify(dbLineHashVersion).hasLineHashesWithoutSignificantCode(file); verifyNoMoreInteractions(dbLineHashVersion); - verifyZeroInteractions(significantCodeRepository); + verifyNoInteractions(significantCodeRepository); } @Test @@ -135,7 +135,7 @@ public class SourceLinesHashRepositoryImplTest { verify(significantCodeRepository).getRangesPerLine(file); verifyNoMoreInteractions(significantCodeRepository); - verifyZeroInteractions(dbLineHashVersion); + verifyNoInteractions(dbLineHashVersion); } @Test @@ -145,7 +145,7 @@ public class SourceLinesHashRepositoryImplTest { verify(significantCodeRepository).getRangesPerLine(file); verifyNoMoreInteractions(significantCodeRepository); - verifyZeroInteractions(dbLineHashVersion); + verifyNoInteractions(dbLineHashVersion); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java index 2824982e792..ce62cb4792d 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java @@ -59,7 +59,6 @@ import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; @@ -285,7 +284,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest { underTest.execute(new TestComputationStepContext()); - verifyZeroInteractions(integrateCrossProjectDuplications); + verifyNoInteractions(integrateCrossProjectDuplications); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistProjectLinksStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistProjectLinksStepTest.java index 31b7ef6129e..f927975e472 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistProjectLinksStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistProjectLinksStepTest.java @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.tuple; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.scanner.protocol.output.ScannerReport.ComponentLink.ComponentLinkType.CI; import static org.sonar.scanner.protocol.output.ScannerReport.ComponentLink.ComponentLinkType.HOME; @@ -82,7 +82,7 @@ public class PersistProjectLinksStepTest extends BaseStepTest { underTest.execute(new TestComputationStepContext()); - verifyZeroInteractions(uuidFactory, reportReader, treeRootHolder, dbClient); + verifyNoInteractions(uuidFactory, reportReader, treeRootHolder, dbClient); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java index 2b6db31d49d..a68cff2659a 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java @@ -53,8 +53,8 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY; import static org.sonar.ce.task.projectanalysis.measure.Measure.Level.ERROR; @@ -286,6 +286,6 @@ public class QualityGateEventsStepTest { underTest.execute(new TestComputationStepContext()); - verifyZeroInteractions(treeRootHolder, metricRepository, measureRepository, eventRepository, notificationService); + verifyNoInteractions(treeRootHolder, metricRepository, measureRepository, eventRepository, notificationService); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java index 18e593ac0a9..b173eff874a 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java @@ -91,8 +91,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.api.rules.RuleType.SECURITY_HOTSPOT; import static org.sonar.ce.task.projectanalysis.component.Component.Type; @@ -284,7 +284,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest { TestComputationStepContext context = new TestComputationStepContext(); underTest.execute(context); - verifyZeroInteractions(notificationService, newIssuesNotificationMock); + verifyNoInteractions(notificationService, newIssuesNotificationMock); } private DefaultIssue createIssue() { diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/TriggerViewRefreshStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/TriggerViewRefreshStepTest.java index 224e94c1f37..9f673a6f913 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/TriggerViewRefreshStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/TriggerViewRefreshStepTest.java @@ -27,7 +27,7 @@ import org.sonar.server.project.Project; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class TriggerViewRefreshStepTest { @@ -39,7 +39,7 @@ public class TriggerViewRefreshStepTest { underTest.execute(new TestComputationStepContext()); - verifyZeroInteractions(analysisMetadataHolder); + verifyNoInteractions(analysisMetadataHolder); } @Test @@ -48,7 +48,7 @@ public class TriggerViewRefreshStepTest { underTest.execute(new TestComputationStepContext()); - verifyZeroInteractions(analysisMetadataHolder); + verifyNoInteractions(analysisMetadataHolder); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStepTest.java index 298e4c5603d..c1ed19c0ce0 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStepTest.java @@ -41,7 +41,7 @@ import org.sonar.db.MyBatis; import org.sonar.db.source.FileSourceDto; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verifyNoInteractions; diff --git a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java index 80fd022d55c..a10b35cd3ed 100644 --- a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java +++ b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.tuple; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class CeTaskMessagesImplTest { @@ -113,7 +113,7 @@ public class CeTaskMessagesImplTest { underTest.addAll(Collections.emptyList()); - verifyZeroInteractions(dbClientMock, uuidFactoryMock, ceTaskMock); + verifyNoInteractions(dbClientMock, uuidFactoryMock, ceTaskMock); } @Test diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java index 3a06182c1f1..c6e1c68f238 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java @@ -26,7 +26,7 @@ import org.sonar.db.DbClient; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class DistributedCEQueueStatusImplTest extends CommonCEQueueStatusImplTest { private DistributedCEQueueStatusImpl underTest = new DistributedCEQueueStatusImpl(getDbClient(), mock(System2.class)); @@ -44,6 +44,6 @@ public class DistributedCEQueueStatusImplTest extends CommonCEQueueStatusImplTes public void getPendingCount_returns_0_without_querying_database() { assertThat(underTest.getPendingCount()).isZero(); - verifyZeroInteractions(getDbClient()); + verifyNoInteractions(getDbClient()); } } diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/notification/ReportAnalysisFailureNotificationExecutionListenerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/notification/ReportAnalysisFailureNotificationExecutionListenerTest.java index d4a5de2dacc..78815154694 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/notification/ReportAnalysisFailureNotificationExecutionListenerTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/notification/ReportAnalysisFailureNotificationExecutionListenerTest.java @@ -55,7 +55,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.db.component.ComponentTesting.newDirectory; import static org.sonar.db.component.ComponentTesting.newModuleDto; @@ -89,14 +89,14 @@ public class ReportAnalysisFailureNotificationExecutionListenerTest { fullMockedUnderTest.onStart(mockedCeTask); - verifyZeroInteractions(mockedCeTask, notificationService, dbClientMock, serializer, system2); + verifyNoInteractions(mockedCeTask, notificationService, dbClientMock, serializer, system2); } @Test public void onEnd_has_no_effect_if_status_is_SUCCESS() { fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.SUCCESS, randomDuration(), ceTaskResultMock, throwableMock); - verifyZeroInteractions(ceTaskMock, ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2); + verifyNoInteractions(ceTaskMock, ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2); } @Test @@ -105,7 +105,7 @@ public class ReportAnalysisFailureNotificationExecutionListenerTest { fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, throwableMock); - verifyZeroInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2); + verifyNoInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2); } @Test @@ -114,7 +114,7 @@ public class ReportAnalysisFailureNotificationExecutionListenerTest { fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, throwableMock); - verifyZeroInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2); + verifyNoInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2); } @Test @@ -127,7 +127,7 @@ public class ReportAnalysisFailureNotificationExecutionListenerTest { fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, throwableMock); - verifyZeroInteractions(ceTaskResultMock, throwableMock, dbClientMock, serializer, system2); + verifyNoInteractions(ceTaskResultMock, throwableMock, dbClientMock, serializer, system2); } @Test @@ -263,7 +263,7 @@ public class ReportAnalysisFailureNotificationExecutionListenerTest { underTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, null); verify(notificationService).deliver(same(notificationMock)); - verifyZeroInteractions(ceTaskResultMock); + verifyNoInteractions(ceTaskResultMock); } @Test diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/platform/DatabaseCompatibilityTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/platform/DatabaseCompatibilityTest.java index 88db4265c7a..689e43b931a 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/platform/DatabaseCompatibilityTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/platform/DatabaseCompatibilityTest.java @@ -30,8 +30,8 @@ import org.sonar.server.platform.db.migration.version.DatabaseVersion; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.platform.db.migration.version.DatabaseVersion.Status.FRESH_INSTALL; import static org.sonar.server.platform.db.migration.version.DatabaseVersion.Status.UP_TO_DATE; @@ -84,6 +84,6 @@ public class DatabaseCompatibilityTest { public void stop_has_no_effect() { underTest.stop(); - verifyZeroInteractions(databaseVersion); + verifyNoInteractions(databaseVersion); } } diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java index bdc737ef294..1f1b1cd1211 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java @@ -28,7 +28,7 @@ import org.sonar.ce.taskprocessor.CeProcessingScheduler; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class CeQueueInitializerTest { @@ -52,7 +52,7 @@ public class CeQueueInitializerTest { underTest.onServerStart(server); - verifyZeroInteractions(processingScheduler, cleaningScheduler); + verifyNoInteractions(processingScheduler, cleaningScheduler); } } diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java index 53ce5b2832d..935948712d7 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java @@ -56,7 +56,7 @@ import static org.assertj.core.api.Assertions.fail; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.container.ComputeEngineStatus.Status.STARTED; import static org.sonar.ce.container.ComputeEngineStatus.Status.STOPPING; @@ -281,7 +281,7 @@ public class InternalCeQueueImplTest { underTest.cancelWornOuts(); assertThat(db.getDbClient().ceActivityDao().selectByUuid(db.getSession(), task.getUuid())).isPresent(); - verifyZeroInteractions(queueStatusMock); + verifyNoInteractions(queueStatusMock); } private static class TypedExceptionImpl extends RuntimeException implements TypedException { diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeWorkerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeWorkerImplTest.java index 2c8e474ff39..77a09c45ee4 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeWorkerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeWorkerImplTest.java @@ -69,7 +69,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.ce.taskprocessor.CeWorker.Result.DISABLED; import static org.sonar.ce.taskprocessor.CeWorker.Result.NO_TASK; @@ -128,7 +128,7 @@ public class CeWorkerImplTest { assertThat(underTest.call()).isEqualTo(DISABLED); - verifyZeroInteractions(taskProcessor, executionListener1, executionListener2); + verifyNoInteractions(taskProcessor, executionListener1, executionListener2); } @Test @@ -138,7 +138,7 @@ public class CeWorkerImplTest { assertThat(underTestNoListener.call()).isEqualTo(DISABLED); - verifyZeroInteractions(taskProcessor, executionListener1, executionListener2); + verifyNoInteractions(taskProcessor, executionListener1, executionListener2); } @Test @@ -147,7 +147,7 @@ public class CeWorkerImplTest { assertThat(underTest.call()).isEqualTo(NO_TASK); - verifyZeroInteractions(taskProcessor, executionListener1, executionListener2); + verifyNoInteractions(taskProcessor, executionListener1, executionListener2); } @Test @@ -156,7 +156,7 @@ public class CeWorkerImplTest { assertThat(underTestNoListener.call()).isEqualTo(NO_TASK); - verifyZeroInteractions(taskProcessor, executionListener1, executionListener2); + verifyNoInteractions(taskProcessor, executionListener1, executionListener2); } @Test diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/SimpleCeTaskInterrupterTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/SimpleCeTaskInterrupterTest.java index fc2b0ff5961..a1fac0ac5ef 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/SimpleCeTaskInterrupterTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/SimpleCeTaskInterrupterTest.java @@ -26,7 +26,7 @@ import org.sonar.ce.task.CeTaskCanceledException; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class SimpleCeTaskInterrupterTest { @@ -60,7 +60,7 @@ public class SimpleCeTaskInterrupterTest { underTest.onStart(ceTask); - verifyZeroInteractions(ceTask); + verifyNoInteractions(ceTask); } @Test @@ -69,6 +69,6 @@ public class SimpleCeTaskInterrupterTest { underTest.onEnd(ceTask); - verifyZeroInteractions(ceTask); + verifyNoInteractions(ceTask); } } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java index de70c5ebfc1..24f0862791c 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java @@ -44,8 +44,8 @@ import org.sonar.api.utils.System2; import org.sonar.core.util.CloseableIterator; import org.sonar.core.util.UuidFactoryFast; import org.sonar.core.util.Uuids; -import org.sonar.db.DbInputStream; import org.sonar.db.DbClient; +import org.sonar.db.DbInputStream; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.alm.setting.AlmSettingDto; @@ -92,7 +92,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.groups.Tuple.tuple; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.db.ce.CeTaskTypes.REPORT; import static org.sonar.db.component.ComponentTesting.newBranchDto; @@ -1443,7 +1443,7 @@ public class PurgeDaoTest { underTest.deleteNonRootComponentsInView(dbSession, Collections.emptyList()); - verifyZeroInteractions(dbSession); + verifyNoInteractions(dbSession); } @Test @@ -1483,7 +1483,7 @@ public class PurgeDaoTest { Collections.shuffle(componentDtos); // order of collection must not matter underTest.deleteNonRootComponentsInView(dbSession, componentDtos); - verifyZeroInteractions(dbSession); + verifyNoInteractions(dbSession); } @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandlerTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandlerTest.java index d0fb3c8f523..e6e53579e62 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandlerTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandlerTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class OracleCharsetHandlerTest { @@ -52,7 +52,7 @@ public class OracleCharsetHandlerTest { public void upgrade_does_not_verify_utf8_charset() throws Exception { underTest.handle(connection, DatabaseCharsetChecker.State.UPGRADE); - verifyZeroInteractions(sqlExecutor); + verifyNoInteractions(sqlExecutor); } @Test @@ -82,7 +82,7 @@ public class OracleCharsetHandlerTest { @Test public void does_nothing_if_regular_startup() throws Exception { underTest.handle(connection, DatabaseCharsetChecker.State.STARTUP); - verifyZeroInteractions(sqlExecutor); + verifyNoInteractions(sqlExecutor); } private void answerCharset(@Nullable String charset) throws SQLException { diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandlerTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandlerTest.java index 0e2047d17b4..49bc05d3562 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandlerTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandlerTest.java @@ -33,7 +33,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class PostgresCharsetHandlerTest { @@ -56,7 +56,7 @@ public class PostgresCharsetHandlerTest { underTest.handle(connection, DatabaseCharsetChecker.State.FRESH_INSTALL); // no errors, charset has been verified verify(metadata).getDefaultCharset(same(connection)); - verifyZeroInteractions(sqlExecutor); + verifyNoInteractions(sqlExecutor); } @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java index f0b31e5c9aa..b8fb2913036 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java @@ -42,7 +42,6 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class MigrationEngineImplTest { diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/history/NoTableMigrationHistoryImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/history/NoTableMigrationHistoryImplTest.java index 63edbf85064..f6b2cd8cb55 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/history/NoTableMigrationHistoryImplTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/history/NoTableMigrationHistoryImplTest.java @@ -25,7 +25,7 @@ import org.sonar.db.CoreDbTester; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class NoTableMigrationHistoryImplTest { @Rule @@ -38,7 +38,7 @@ public class NoTableMigrationHistoryImplTest { public void start_fails_with_ISE_if_table_history_does_not_exist() { assertThatThrownBy(() -> { underTest.start(); - verifyZeroInteractions(migrationHistoryMeddler); + verifyNoInteractions(migrationHistoryMeddler); }) .isInstanceOf(IllegalStateException.class) .hasMessage("Migration history table is missing"); diff --git a/server/sonar-main/src/test/java/org/sonar/application/AppReloaderImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/AppReloaderImplTest.java index 2b6bc10ad0d..344de801487 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/AppReloaderImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/AppReloaderImplTest.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.data.MapEntry.entry; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED; import static org.sonar.process.ProcessProperties.Property.PATH_DATA; @@ -72,9 +72,9 @@ public class AppReloaderImplTest { assertThatThrownBy(() -> { underTest.reload(settings); - verifyZeroInteractions(logging); - verifyZeroInteractions(state); - verifyZeroInteractions(fs); + verifyNoInteractions(logging); + verifyNoInteractions(state); + verifyNoInteractions(fs); }) .isInstanceOf(IllegalStateException.class) .hasMessage("Restart is not possible with cluster mode"); @@ -101,9 +101,9 @@ public class AppReloaderImplTest { assertThatThrownBy(() -> { underTest.reload(settings); - verifyZeroInteractions(logging); - verifyZeroInteractions(state); - verifyZeroInteractions(fs); + verifyNoInteractions(logging); + verifyNoInteractions(state); + verifyNoInteractions(fs); }) .isInstanceOf(MessageException.class) .hasMessage("Property [" + propertyKey + "] cannot be changed on restart: [val1] => [val2]"); diff --git a/server/sonar-process/src/test/java/org/sonar/process/cluster/health/HealthStateRefresherTest.java b/server/sonar-process/src/test/java/org/sonar/process/cluster/health/HealthStateRefresherTest.java index d72b8e4d3be..2bc314c09e6 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/cluster/health/HealthStateRefresherTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/cluster/health/HealthStateRefresherTest.java @@ -34,7 +34,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.slf4j.event.Level.DEBUG; import static org.slf4j.event.Level.ERROR; @@ -91,7 +91,7 @@ public class HealthStateRefresherTest { underTest.stop(); verify(sharedHealthState).clearMine(); - verifyZeroInteractions(executorService, nodeHealthProvider); + verifyNoInteractions(executorService, nodeHealthProvider); } @Test diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/searchrequest/TopAggregationHelperTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/searchrequest/TopAggregationHelperTest.java index 3df4ade37de..be531373b42 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/es/searchrequest/TopAggregationHelperTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/searchrequest/TopAggregationHelperTest.java @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.es.searchrequest.TopAggregationHelper.NO_EXTRA_FILTER; import static org.sonar.server.es.searchrequest.TopAggregationHelper.NO_OTHER_SUBAGGREGATION; @@ -139,7 +139,7 @@ public class TopAggregationHelperTest { underTest.buildTopAggregation(topAggregationName, topAggregation, NO_EXTRA_FILTER, t -> t.subAggregation(subAggregation)); - verifyZeroInteractions(subAggregationHelper); + verifyNoInteractions(subAggregationHelper); } @Test diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java index fa5eb7a58c1..83477da167d 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java @@ -55,8 +55,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anySet; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.core.util.stream.MoreCollectors.index; import static org.sonar.core.util.stream.MoreCollectors.unorderedIndex; @@ -116,7 +116,7 @@ public class ChangesOnMyIssueNotificationHandlerTest { int deliver = underTest.deliver(Collections.emptyList()); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager, emailNotificationChannel); + verifyNoInteractions(notificationManager, emailNotificationChannel); } @Test @@ -129,10 +129,10 @@ public class ChangesOnMyIssueNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -151,7 +151,7 @@ public class ChangesOnMyIssueNotificationHandlerTest { int deliver = underTest.deliver(ImmutableSet.of(serializer.serialize(builder))); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); } @@ -182,7 +182,7 @@ public class ChangesOnMyIssueNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); } diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FPOrWontFixNotificationHandlerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FPOrWontFixNotificationHandlerTest.java index 318c105cc1a..1a32c475fa5 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FPOrWontFixNotificationHandlerTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FPOrWontFixNotificationHandlerTest.java @@ -57,8 +57,8 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.api.issue.Issue.RESOLUTION_FALSE_POSITIVE; import static org.sonar.api.issue.Issue.RESOLUTION_WONT_FIX; @@ -120,10 +120,10 @@ public class FPOrWontFixNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -176,9 +176,9 @@ public class FPOrWontFixNotificationHandlerTest { assertThat(deliver).isZero(); verify(serializer, times(notifications.size())).from(any(IssuesChangesNotification.class)); - verifyZeroInteractions(changeMock); + verifyNoInteractions(changeMock); verifyNoMoreInteractions(serializer); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); } @@ -198,9 +198,9 @@ public class FPOrWontFixNotificationHandlerTest { assertThat(deliver).isZero(); verify(serializer, times(notifications.size())).from(any(IssuesChangesNotification.class)); - verifyZeroInteractions(changeMock); + verifyNoInteractions(changeMock); verifyNoMoreInteractions(serializer); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); } @@ -257,7 +257,7 @@ public class FPOrWontFixNotificationHandlerTest { verifyNoMoreInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - verifyZeroInteractions(changeMock); + verifyNoInteractions(changeMock); } @Test diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationHandlerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationHandlerTest.java index 56f155d8380..6e3684715a8 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationHandlerTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationHandlerTest.java @@ -41,8 +41,8 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION; import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; @@ -92,7 +92,7 @@ public class MyNewIssuesNotificationHandlerTest { int deliver = underTest.deliver(Collections.emptyList()); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager, emailNotificationChannel); + verifyNoInteractions(notificationManager, emailNotificationChannel); } @Test @@ -105,10 +105,10 @@ public class MyNewIssuesNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -121,7 +121,7 @@ public class MyNewIssuesNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); notifications.forEach(notification -> { @@ -140,7 +140,7 @@ public class MyNewIssuesNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); notifications.forEach(notification -> { diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationHandlerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationHandlerTest.java index b90f93b78a4..5abc5adc698 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationHandlerTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationHandlerTest.java @@ -40,8 +40,8 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION; import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; @@ -90,7 +90,7 @@ public class NewIssuesNotificationHandlerTest { int deliver = underTest.deliver(Collections.emptyList()); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager, emailNotificationChannel); + verifyNoInteractions(notificationManager, emailNotificationChannel); } @Test @@ -103,10 +103,10 @@ public class NewIssuesNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -119,7 +119,7 @@ public class NewIssuesNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); notifications.forEach(notification -> { diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/notification/NotificationServiceTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/notification/NotificationServiceTest.java index a39d505306b..546a2997297 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/notification/NotificationServiceTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/notification/NotificationServiceTest.java @@ -40,8 +40,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class NotificationServiceTest { @@ -75,7 +75,7 @@ public class NotificationServiceTest { NotificationService underTest = new NotificationService(dbClient); assertThat(underTest.deliverEmails(notifications)).isZero(); - verifyZeroInteractions(dbClient); + verifyNoInteractions(dbClient); } @Test @@ -87,8 +87,8 @@ public class NotificationServiceTest { NotificationService underTest = new NotificationService(dbClient, new NotificationDispatcher[] {dispatcher}); assertThat(underTest.deliverEmails(notifications)).isZero(); - verifyZeroInteractions(dispatcher); - verifyZeroInteractions(dbClient); + verifyNoInteractions(dispatcher); + verifyNoInteractions(dbClient); } @Test @@ -99,7 +99,7 @@ public class NotificationServiceTest { new NotificationHandler[] {handler1, handler2}); assertThat(underTest.deliverEmails(Collections.emptyList())).isZero(); - verifyZeroInteractions(handler1, handler2); + verifyNoInteractions(handler1, handler2); } @Test diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeNotificationHandlerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeNotificationHandlerTest.java index ed795d13d2f..41d3689b05e 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeNotificationHandlerTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeNotificationHandlerTest.java @@ -38,8 +38,8 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION; import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; @@ -88,7 +88,7 @@ public class QGChangeNotificationHandlerTest { int deliver = underTest.deliver(Collections.emptyList()); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager, emailNotificationChannel); + verifyNoInteractions(notificationManager, emailNotificationChannel); } @Test @@ -101,10 +101,10 @@ public class QGChangeNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -117,7 +117,7 @@ public class QGChangeNotificationHandlerTest { int deliver = underTest.deliver(notifications); assertThat(deliver).isZero(); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); notifications.forEach(notification -> { diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java index 01fdf0140ab..cd83615d99b 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java @@ -56,8 +56,8 @@ import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class QGChangeEventListenersImplTest { @@ -83,14 +83,14 @@ public class QGChangeEventListenersImplTest { public void broadcastOnIssueChange_has_no_effect_when_issues_are_empty() { underTest.broadcastOnIssueChange(emptyList(), singletonList(component1QGChangeEvent)); - verifyZeroInteractions(listener1, listener2, listener3); + verifyNoInteractions(listener1, listener2, listener3); } @Test public void broadcastOnIssueChange_has_no_effect_when_no_changeEvent() { underTest.broadcastOnIssueChange(oneIssueOnComponent1, emptySet()); - verifyZeroInteractions(listener1, listener2, listener3); + verifyNoInteractions(listener1, listener2, listener3); } @Test @@ -171,7 +171,7 @@ public class QGChangeEventListenersImplTest { underTest.broadcastOnIssueChange(oneIssueOnComponent1, singletonList(component1QGChangeEvent)); - verifyZeroInteractions(listener1, listener2, listener3); + verifyNoInteractions(listener1, listener2, listener3); } @Test diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BasicAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BasicAuthenticationTest.java index b83866f91f7..d80ff6aa193 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BasicAuthenticationTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BasicAuthenticationTest.java @@ -38,8 +38,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.authentication.event.AuthenticationEvent.Method.BASIC; import static org.sonar.server.authentication.event.AuthenticationEvent.Method.BASIC_TOKEN; @@ -98,7 +98,7 @@ public class BasicAuthenticationTest { public void does_not_authenticate_when_no_authorization_header() { underTest.authenticate(request); - verifyZeroInteractions(credentialsAuthentication, authenticationEvent); + verifyNoInteractions(credentialsAuthentication, authenticationEvent); } @Test @@ -107,7 +107,7 @@ public class BasicAuthenticationTest { underTest.authenticate(request); - verifyZeroInteractions(credentialsAuthentication, authenticationEvent); + verifyNoInteractions(credentialsAuthentication, authenticationEvent); } @Test @@ -118,7 +118,7 @@ public class BasicAuthenticationTest { .isInstanceOf(AuthenticationException.class) .hasFieldOrPropertyWithValue("source", Source.local(BASIC)); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -154,7 +154,7 @@ public class BasicAuthenticationTest { .isInstanceOf(AuthenticationException.class) .hasFieldOrPropertyWithValue("source", Source.local(BASIC_TOKEN)); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -167,7 +167,7 @@ public class BasicAuthenticationTest { .isInstanceOf(AuthenticationException.class) .hasFieldOrPropertyWithValue("source", Source.local(BASIC_TOKEN)); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -181,7 +181,7 @@ public class BasicAuthenticationTest { .isInstanceOf(AuthenticationException.class) .hasFieldOrPropertyWithValue("source", Source.local(BASIC_TOKEN)); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } private static String toBase64(String text) { diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java index 02661e1ff2a..e343190c734 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java @@ -40,8 +40,8 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.authentication.event.AuthenticationEvent.Method.BASIC; import static org.sonar.server.authentication.event.AuthenticationEvent.Method.BASIC_TOKEN; @@ -190,7 +190,7 @@ public class CredentialsExternalAuthenticationTest { .hasFieldOrPropertyWithValue("source", Source.realm(BASIC, REALM_NAME)) .hasFieldOrPropertyWithValue("login", LOGIN); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -206,7 +206,7 @@ public class CredentialsExternalAuthenticationTest { .hasFieldOrPropertyWithValue("source", Source.realm(BASIC, REALM_NAME)) .hasFieldOrPropertyWithValue("login", LOGIN); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @@ -224,7 +224,7 @@ public class CredentialsExternalAuthenticationTest { .hasFieldOrPropertyWithValue("source", Source.realm(BASIC_TOKEN, REALM_NAME)) .hasFieldOrPropertyWithValue("login", LOGIN); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java index 34de3ae50e6..6a8b42ab979 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java @@ -55,7 +55,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.db.user.UserTesting.newUserDto; @@ -207,7 +207,7 @@ public class HttpHeadersAuthenticationTest { // User is not updated verifyUserInDb(DEFAULT_LOGIN, DEFAULT_NAME, DEFAULT_EMAIL, group1); verifyTokenIsNotUpdated(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -255,7 +255,7 @@ public class HttpHeadersAuthenticationTest { // User is not updated verifyUserInDb(DEFAULT_LOGIN, DEFAULT_NAME, DEFAULT_EMAIL, group1); verifyTokenIsNotUpdated(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -325,7 +325,7 @@ public class HttpHeadersAuthenticationTest { verifyUserNotAuthenticated(); verifyTokenIsNotUpdated(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -335,7 +335,7 @@ public class HttpHeadersAuthenticationTest { underTest.authenticate(createRequest(DEFAULT_LOGIN, DEFAULT_NAME, DEFAULT_EMAIL, GROUPS), response); verifyUserNotAuthenticated(); - verifyZeroInteractions(jwtHttpHandler, authenticationEvent); + verifyNoInteractions(jwtHttpHandler, authenticationEvent); } @Test @@ -348,7 +348,7 @@ public class HttpHeadersAuthenticationTest { .isInstanceOf(AuthenticationException.class) .hasFieldOrPropertyWithValue("source", Source.sso()); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } private void startWithSso() { diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/InitFilterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/InitFilterTest.java index fb162f465b8..b37ce1bf893 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/InitFilterTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/InitFilterTest.java @@ -42,7 +42,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class InitFilterTest { @@ -97,7 +97,7 @@ public class InitFilterTest { underTest.doFilter(request, response, chain); assertOAuth2InitCalled(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -108,7 +108,7 @@ public class InitFilterTest { underTest.doFilter(request, response, chain); assertOAuth2InitCalled(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -119,7 +119,7 @@ public class InitFilterTest { underTest.doFilter(request, response, chain); assertBasicInitCalled(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -150,8 +150,8 @@ public class InitFilterTest { underTest.doFilter(request, response, chain); assertError("No provider key found in URI"); - verifyZeroInteractions(authenticationEvent); - verifyZeroInteractions(auth2AuthenticationParameters); + verifyNoInteractions(authenticationEvent); + verifyNoInteractions(auth2AuthenticationParameters); } @Test @@ -161,8 +161,8 @@ public class InitFilterTest { underTest.doFilter(request, response, chain); assertError("No provider key found in URI"); - verifyZeroInteractions(authenticationEvent); - verifyZeroInteractions(auth2AuthenticationParameters); + verifyNoInteractions(authenticationEvent); + verifyNoInteractions(auth2AuthenticationParameters); } @Test @@ -175,8 +175,8 @@ public class InitFilterTest { underTest.doFilter(request, response, chain); assertError("Unsupported IdentityProvider class: class org.sonar.server.authentication.InitFilterTest$UnsupportedIdentityProvider"); - verifyZeroInteractions(authenticationEvent); - verifyZeroInteractions(auth2AuthenticationParameters); + verifyNoInteractions(authenticationEvent); + verifyNoInteractions(auth2AuthenticationParameters); } @Test diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java index 73afe2da1d5..f9912c29f8e 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.authentication.event.AuthenticationEvent.Source; @@ -136,7 +136,7 @@ public class OAuth2CallbackFilterTest { underTest.doFilter(request, response, chain); assertError("Not an OAuth2IdentityProvider: class org.sonar.server.authentication.FakeBasicIdentityProvider"); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -147,7 +147,7 @@ public class OAuth2CallbackFilterTest { underTest.doFilter(request, response, chain); assertError("Failed to retrieve IdentityProvider for key 'github'"); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test @@ -222,7 +222,7 @@ public class OAuth2CallbackFilterTest { underTest.doFilter(request, response, chain); assertError("No provider key found in URI"); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } private void assertCallbackCalled(FakeOAuth2IdentityProvider oAuth2IdentityProvider) { diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java index 37f9861e33c..98f9db19d83 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java @@ -35,7 +35,7 @@ import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.authentication.event.AuthenticationEvent.Method; import static org.sonar.server.authentication.event.AuthenticationEvent.Source; @@ -80,7 +80,7 @@ public class AuthenticationEventImplTest { underTest.loginSuccess(request, "login", Source.sso()); - verifyZeroInteractions(request); + verifyNoInteractions(request); } @Test @@ -154,7 +154,7 @@ public class AuthenticationEventImplTest { underTest.loginFailure(request, exception); - verifyZeroInteractions(request, exception); + verifyNoInteractions(request, exception); } @Test @@ -252,7 +252,7 @@ public class AuthenticationEventImplTest { underTest.logoutSuccess(request, "foo"); - verifyZeroInteractions(request); + verifyNoInteractions(request); } @Test @@ -317,7 +317,7 @@ public class AuthenticationEventImplTest { underTest.logoutFailure(request, "bad csrf"); - verifyZeroInteractions(request); + verifyNoInteractions(request); } @Test diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java index e52f4db65d3..b31c7476c70 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java @@ -52,8 +52,8 @@ import static org.apache.commons.lang.RandomStringUtils.random; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; @RunWith(DataProviderRunner.class) @@ -239,7 +239,7 @@ public class EmailNotificationChannelTest { int count = underTest.deliverAll(Collections.emptySet()); assertThat(count).isZero(); - verifyZeroInteractions(emailSettings); + verifyNoInteractions(emailSettings); assertThat(smtpServer.getMessages()).isEmpty(); } diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/AutoDbMigrationTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/AutoDbMigrationTest.java index 65a751a69bf..8e92b826eda 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/AutoDbMigrationTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/AutoDbMigrationTest.java @@ -36,7 +36,7 @@ import org.sonar.server.platform.db.migration.engine.MigrationEngine; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class AutoDbMigrationTest { @@ -84,7 +84,7 @@ public class AutoDbMigrationTest { underTest.start(); - verifyZeroInteractions(migrationEngine); + verifyNoInteractions(migrationEngine); assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty(); } @@ -108,7 +108,7 @@ public class AutoDbMigrationTest { underTest.start(); - verifyZeroInteractions(migrationEngine); + verifyNoInteractions(migrationEngine); assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty(); } diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java index 23e4e7d3a30..4e98d1f2136 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java @@ -60,7 +60,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.core.util.stream.MoreCollectors.toArrayList; import static org.sonar.db.component.BranchType.BRANCH; @@ -94,7 +94,7 @@ public class WebhookQGChangeEventListenerTest { mockedUnderTest.onIssueChanges(qualityGateEvent, CHANGED_ISSUES_ARE_IGNORED); verify(webHooks).isEnabled(qualityGateEvent.getProject()); - verifyZeroInteractions(webhookPayloadFactory, mockedDbClient); + verifyNoInteractions(webhookPayloadFactory, mockedDbClient); } @DataProvider @@ -121,7 +121,7 @@ public class WebhookQGChangeEventListenerTest { underTest.onIssueChanges(qualityGateEvent, CHANGED_ISSUES_ARE_IGNORED); - verifyZeroInteractions(webhookPayloadFactory, mockedDbClient); + verifyNoInteractions(webhookPayloadFactory, mockedDbClient); } @Test @@ -134,7 +134,7 @@ public class WebhookQGChangeEventListenerTest { underTest.onIssueChanges(qualityGateEvent, CHANGED_ISSUES_ARE_IGNORED); - verifyZeroInteractions(webhookPayloadFactory, mockedDbClient); + verifyNoInteractions(webhookPayloadFactory, mockedDbClient); } @Test diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java index c23c2eb8563..66037612164 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java @@ -48,7 +48,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.server.authentication.event.AuthenticationEvent.Method.FORM; @@ -116,8 +116,8 @@ public class LoginActionTest { assertThat(threadLocalUserSession.isLoggedIn()).isTrue(); verify(credentialsAuthentication).authenticate(new Credentials(LOGIN, PASSWORD), request, FORM); verify(jwtHttpHandler).generateToken(user, request, response); - verifyZeroInteractions(chain); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(chain); + verifyNoInteractions(authenticationEvent); } @Test @@ -126,8 +126,8 @@ public class LoginActionTest { underTest.doFilter(request, response, chain); - verifyZeroInteractions(credentialsAuthentication, jwtHttpHandler, chain); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(credentialsAuthentication, jwtHttpHandler, chain); + verifyNoInteractions(authenticationEvent); } @Test @@ -138,7 +138,7 @@ public class LoginActionTest { verify(response).setStatus(401); assertThat(threadLocalUserSession.hasSession()).isFalse(); - verifyZeroInteractions(authenticationEvent); + verifyNoInteractions(authenticationEvent); } @Test diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/branch/pr/ws/DeleteActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/branch/pr/ws/DeleteActionTest.java index 147bc72ccb4..778ad2d13cd 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/branch/pr/ws/DeleteActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/branch/pr/ws/DeleteActionTest.java @@ -39,7 +39,7 @@ import org.sonar.server.ws.WsActionTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.sonar.db.component.BranchType.PULL_REQUEST; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java index 52c466dfb0a..8089d8e3402 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java @@ -29,7 +29,7 @@ import org.sonar.server.ws.WsActionTester; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class CancelAllActionTest { @@ -56,7 +56,7 @@ public class CancelAllActionTest { assertThatThrownBy(() -> { call(); - verifyZeroInteractions(queue); + verifyNoInteractions(queue); }) .isInstanceOf(ForbiddenException.class) .hasMessage("Insufficient privileges"); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java index 72c7d3e7011..99607f9c6e3 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java @@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class CommentActionTest { @@ -72,7 +72,7 @@ public class CommentActionTest { } catch (Exception e) { assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Missing parameter : 'comment'"); } - verifyZeroInteractions(issueUpdater); + verifyNoInteractions(issueUpdater); } @Test diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/IssueUpdaterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/IssueUpdaterTest.java index e55529f7225..d8a70c3c710 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/IssueUpdaterTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/IssueUpdaterTest.java @@ -52,7 +52,7 @@ import org.sonar.server.rule.DefaultRuleFinder; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.sonar.api.issue.Issue.RESOLUTION_FIXED; import static org.sonar.api.rule.Severity.BLOCKER; import static org.sonar.api.rule.Severity.MAJOR; @@ -198,7 +198,7 @@ public class IssueUpdaterTest { underTest.saveIssueAndPreloadSearchResponseData(db.getSession(), issue, context, false); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); } @Test @@ -212,7 +212,7 @@ public class IssueUpdaterTest { underTest.saveIssueAndPreloadSearchResponseData(db.getSession(), issue, context, false); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); } @Test diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/IndexActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/IndexActionTest.java index 4c533efec84..6a645b491df 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/IndexActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/IndexActionTest.java @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.test.JsonAssert.assertJson; @@ -64,7 +64,7 @@ public class IndexActionTest { TestResponse result = call(null, DateUtils.formatDateTime(aBitLater)); - verifyZeroInteractions(i18n); + verifyNoInteractions(i18n); verify(server).getStartedAt(); assertThat(result.getStatus()).isEqualTo(HttpURLConnection.HTTP_NOT_MODIFIED); } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java index 256f49b0875..f287b02a097 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java @@ -57,7 +57,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.test.JsonAssert.assertJson; @@ -284,7 +284,7 @@ public class InstalledActionTest { String response = tester.newRequest().execute().getInput(); - verifyZeroInteractions(updateCenterMatrixFactory); + verifyNoInteractions(updateCenterMatrixFactory); assertJson(response).isSimilarTo( "{" + " \"plugins\":" + @@ -445,7 +445,7 @@ public class InstalledActionTest { String response = tester.newRequest().execute().getInput(); - verifyZeroInteractions(updateCenterMatrixFactory); + verifyNoInteractions(updateCenterMatrixFactory); assertJson(response) .isSimilarTo("{" + " \"plugins\":" + diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java index 7422ae3ca15..400baaf738e 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java @@ -38,7 +38,7 @@ import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class QProfileCopierTest { @@ -90,7 +90,7 @@ public class QProfileCopierTest { fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("Source and target profiles are equal: " + source.getName()); - verifyZeroInteractions(backuper); + verifyNoInteractions(backuper); } } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryImplTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryImplTest.java index a9137a756ed..c185e40e7f9 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryImplTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryImplTest.java @@ -57,7 +57,7 @@ import static org.mockito.ArgumentMatchers.anyCollection; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class QProfileFactoryImplTest { @@ -207,7 +207,7 @@ public class QProfileFactoryImplTest { underTest.delete(dbSession, Collections.emptyList()); - verifyZeroInteractions(activeRuleIndexer); + verifyNoInteractions(activeRuleIndexer); assertQualityProfileFromDb(profile).isNotNull(); } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java index 7beb4f45b5d..f5153a0d973 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java @@ -74,7 +74,6 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.api.rules.RulePriority.MAJOR; import static org.sonar.db.qualityprofile.QualityProfileTesting.newRuleProfileDto; @@ -119,7 +118,7 @@ public class RegisterQualityProfilesNotificationTest { underTest.start(); - verifyZeroInteractions(builtInQualityProfilesNotification); + verifyNoInteractions(builtInQualityProfilesNotification); } @Test diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandlerTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandlerTest.java index 3669e86518d..acc10ee9550 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandlerTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandlerTest.java @@ -36,8 +36,8 @@ import static java.util.stream.Collectors.toSet; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class BuiltInQPChangeNotificationHandlerTest { @@ -76,8 +76,8 @@ public class BuiltInQPChangeNotificationHandlerTest { assertThat(deliver).isZero(); verify(emailNotificationChannel).isActivated(); verifyNoMoreInteractions(emailNotificationChannel); - verifyZeroInteractions(dbClient); - notifications.forEach(Mockito::verifyZeroInteractions); + verifyNoInteractions(dbClient); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -99,7 +99,7 @@ public class BuiltInQPChangeNotificationHandlerTest { verifyNoMoreInteractions(dbClient); verify(authorizationDao).selectQualityProfileAdministratorLogins(dbSession); verifyNoMoreInteractions(authorizationDao); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } @Test @@ -130,7 +130,7 @@ public class BuiltInQPChangeNotificationHandlerTest { verifyNoMoreInteractions(dbClient); verify(authorizationDao).selectQualityProfileAdministratorLogins(dbSession); verifyNoMoreInteractions(authorizationDao); - notifications.forEach(Mockito::verifyZeroInteractions); + notifications.forEach(Mockito::verifyNoInteractions); } } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQualityProfilesUpdateListenerTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQualityProfilesUpdateListenerTest.java index 74c55554002..aac2248e266 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQualityProfilesUpdateListenerTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/builtin/BuiltInQualityProfilesUpdateListenerTest.java @@ -41,8 +41,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.sonar.core.config.CorePropertyDefinitions.DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES; import static org.sonar.server.language.LanguageTesting.newLanguage; import static org.sonar.server.qualityprofile.ActiveRuleChange.Type.ACTIVATED; @@ -157,7 +157,7 @@ public class BuiltInQualityProfilesUpdateListenerTest { BuiltInQualityProfilesUpdateListener underTest = new BuiltInQualityProfilesUpdateListener(notificationManager, languages, settings.asConfig()); underTest.onChange(profiles, 0, 1); - verifyZeroInteractions(notificationManager); + verifyNoInteractions(notificationManager); } private Tuple addProfile(Multimap profiles, Languages languages, ActiveRuleChange.Type type) { diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java index 2af81da0f0c..0d5a9e9df5d 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java @@ -28,7 +28,7 @@ import javax.servlet.ServletContext; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class NullJarScannerTest { @Test @@ -39,7 +39,7 @@ public class NullJarScannerTest { NullJarScanner scanner = new NullJarScanner(); scanner.scan(JarScanType.PLUGGABILITY, context, callback); - verifyZeroInteractions(context, callback); + verifyNoInteractions(context, callback); scanner.setJarScanFilter(mock(JarScanFilter.class)); assertThat(scanner.getJarScanFilter()).isNull(); } diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java index 90fec94330e..9ccf82998f9 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java @@ -36,7 +36,7 @@ import org.sonar.process.Props; import static org.mockito.Mockito.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.sonar.process.ProcessProperties.Property.PATH_LOGS; public class TomcatAccessLogTest { @@ -69,7 +69,7 @@ public class TomcatAccessLogTest { LifecycleEvent event = new LifecycleEvent(mock(Lifecycle.class), "before_init", null); listener.lifecycleEvent(event); - verifyZeroInteractions(logger); + verifyNoInteractions(logger); event = new LifecycleEvent(mock(Lifecycle.class), "after_start", null); listener.lifecycleEvent(event); diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java index 07460569492..431886dbbb5 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import static java.lang.String.format; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class CacheControlFilterTest { @@ -88,7 +88,7 @@ public class CacheControlFilterTest { underTest.doFilter(request, response, chain); - verifyZeroInteractions(response); + verifyNoInteractions(response); } @Test @@ -97,7 +97,7 @@ public class CacheControlFilterTest { underTest.doFilter(request, response, chain); - verifyZeroInteractions(response); + verifyNoInteractions(response); } private static HttpServletRequest newRequest(String path) { diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java index e7c8afbe558..25d0eb807d3 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class RedirectFilterTest { @@ -66,7 +66,7 @@ public class RedirectFilterTest { underTest.doFilter(request, response, chain); verify(response).sendRedirect(expectedRedirection); - verifyZeroInteractions(chain); + verifyNoInteractions(chain); reset(response, chain); } @@ -78,7 +78,7 @@ public class RedirectFilterTest { underTest.doFilter(request, response, chain); verify(chain).doFilter(request, response); - verifyZeroInteractions(response); + verifyNoInteractions(response); reset(response, chain); } } diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java index 727cd75483d..6e1504d5c37 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.RETURNS_MOCKS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class WebPagesFilterTest { @@ -78,7 +78,7 @@ public class WebPagesFilterTest { underTest.doFilter(request, response, chain); verify(chain).doFilter(request, response); - verifyZeroInteractions(webPagesCache); + verifyNoInteractions(webPagesCache); } static class StringOutputStream extends ServletOutputStream { diff --git a/sonar-core/src/test/java/org/sonar/core/i18n/DurationLabelTest.java b/sonar-core/src/test/java/org/sonar/core/i18n/DurationLabelTest.java index a8700012609..e58ac066c36 100644 --- a/sonar-core/src/test/java/org/sonar/core/i18n/DurationLabelTest.java +++ b/sonar-core/src/test/java/org/sonar/core/i18n/DurationLabelTest.java @@ -21,7 +21,7 @@ package org.sonar.core.i18n; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java b/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java index 5dd30052181..94d741b004b 100644 --- a/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java +++ b/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.startsWith; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class ComponentKeysTest { @@ -51,7 +51,7 @@ public class ComponentKeysTest { public void should_log_warning_if_toString_is_not_overridden() { Logger log = mock(Logger.class); keys.of(new Object(), log); - verifyZeroInteractions(log); + verifyNoInteractions(log); // only on non-first runs, to avoid false-positives on singletons keys.of(new Object(), log); diff --git a/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java b/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java index 51f3b2158d1..e1dddd28b79 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java @@ -47,6 +47,7 @@ import org.junit.rules.Timeout; import org.simpleframework.http.Request; import org.simpleframework.http.Response; import org.simpleframework.http.core.Container; +import org.simpleframework.http.core.ContainerServer; import org.simpleframework.transport.connect.SocketConnection; import org.sonar.api.CoreProperties; import org.sonar.api.config.internal.MapSettings; @@ -75,12 +76,12 @@ public class DefaultHttpDownloaderTest { @BeforeClass public static void startServer() throws IOException { - socketConnection = new SocketConnection(new Container() { + socketConnection = new SocketConnection(new ContainerServer(new Container() { public void handle(Request req, Response resp) { try { if (req.getPath().getPath().contains("/redirect/")) { resp.setCode(303); - resp.add("Location", "/"); + resp.setValue("Location", "/"); } else { if (req.getPath().getPath().contains("/timeout/")) { try { @@ -93,7 +94,7 @@ public class DefaultHttpDownloaderTest { if (!"gzip".equals(req.getValue("Accept-Encoding"))) { throw new IllegalStateException("Should accept gzip"); } - resp.set("Content-Encoding", "gzip"); + resp.setValue("Content-Encoding", "gzip"); GZIPOutputStream gzipOutputStream = new GZIPOutputStream(resp.getOutputStream()); gzipOutputStream.write("GZIP response".getBytes()); gzipOutputStream.close(); @@ -110,7 +111,7 @@ public class DefaultHttpDownloaderTest { } } } - }); + })); SocketAddress address = socketConnection.connect(new InetSocketAddress("localhost", 0)); baseUrl = String.format("http://%s:%d", ((InetSocketAddress) address).getAddress().getHostAddress(), ((InetSocketAddress) address).getPort()); diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/BlackHoleTokenChannelTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/BlackHoleTokenChannelTest.java index a8c1fa521f4..8f8c51c12c5 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/token/BlackHoleTokenChannelTest.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/BlackHoleTokenChannelTest.java @@ -24,7 +24,7 @@ import org.sonar.channel.CodeReader; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class BlackHoleTokenChannelTest { @@ -37,7 +37,7 @@ public class BlackHoleTokenChannelTest { assertThat(channel.consume(codeReader, output)).isTrue(); assertThat(codeReader.getLinePosition()).isOne(); assertThat(codeReader.getColumnPosition()).isEqualTo(3); - verifyZeroInteractions(output); + verifyNoInteractions(output); } } diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java index cccabc53a90..35a12b953a5 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java @@ -23,8 +23,8 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -69,7 +69,7 @@ public class TokenChannelTest { CodeReader codeReader = new CodeReader("123"); assertThat(channel.consume(new CodeReader("123"), output), is(false)); - verifyZeroInteractions(output); + verifyNoInteractions(output); assertThat(codeReader.getLinePosition(), is(1)); assertThat(codeReader.getColumnPosition(), is(0)); } diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java index 059d4239488..770bc7eae8d 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java @@ -21,17 +21,16 @@ package org.sonar.api.batch.sensor.cpd.internal; import org.junit.Test; import org.sonar.api.batch.fs.InputFile; -import org.sonar.api.batch.sensor.cpd.internal.DefaultCpdTokens; -import org.sonar.api.batch.sensor.internal.SensorStorage; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; +import org.sonar.api.batch.sensor.internal.SensorStorage; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; import static org.assertj.core.api.Assertions.tuple; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class DefaultCpdTokensTest { private final SensorStorage sensorStorage = mock(SensorStorage.class); @@ -77,7 +76,7 @@ public class DefaultCpdTokensTest { tokens.save(); - verifyZeroInteractions(sensorStorage); + verifyNoInteractions(sensorStorage); assertThat(tokens.getTokenLines()).isEmpty(); } @@ -97,7 +96,7 @@ public class DefaultCpdTokensTest { .addToken(testInputFile.newRange(1, 2, 1, 5), "foo"); tokens.save(); - verifyZeroInteractions(sensorStorage); + verifyNoInteractions(sensorStorage); assertThat(tokens.getTokenLines()).isEmpty(); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java index d948da7f0c1..0c4d98d490a 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.startsWith; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class ConsoleLoggerTest { @@ -66,7 +66,7 @@ public class ConsoleLoggerTest { underTest.debug("message {}", "foo"); underTest.debug("message {} {}", "foo", "bar"); underTest.debug("message {} {} {}", "foo", "bar", "baz"); - verifyZeroInteractions(stream); + verifyNoInteractions(stream); } @Test @@ -89,7 +89,7 @@ public class ConsoleLoggerTest { underTest.trace("message {}", "foo"); underTest.trace("message {} {}", "foo", "bar"); underTest.trace("message {} {} {}", "foo", "bar", "baz"); - verifyZeroInteractions(stream); + verifyNoInteractions(stream); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java index d23e829b11b..2464b134585 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java @@ -40,7 +40,7 @@ import org.sonar.scanner.cpd.index.SonarCpdBlockIndex; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class JavaCpdBlockIndexerSensorTest { @@ -73,7 +73,7 @@ public class JavaCpdBlockIndexerSensorTest { public void testExclusions() { file.setExcludedForDuplication(true); new JavaCpdBlockIndexerSensor(index).execute(context); - verifyZeroInteractions(index); + verifyNoInteractions(index); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java index 1cf46979e80..5e63367f913 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java @@ -29,7 +29,7 @@ import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.fs.InputComponent; import org.sonar.api.batch.rule.internal.NewActiveRule; @@ -53,7 +53,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -97,7 +97,7 @@ public class IssuePublisherTest { boolean added = moduleIssues.initAndAddIssue(issue); assertThat(added).isFalse(); - verifyZeroInteractions(reportPublisher); + verifyNoInteractions(reportPublisher); } @Test @@ -112,7 +112,7 @@ public class IssuePublisherTest { boolean added = moduleIssues.initAndAddIssue(issue); assertThat(added).isFalse(); - verifyZeroInteractions(reportPublisher); + verifyNoInteractions(reportPublisher); } @Test @@ -200,7 +200,7 @@ public class IssuePublisherTest { boolean added = moduleIssues.initAndAddIssue(issue); assertThat(added).isFalse(); - verifyZeroInteractions(reportPublisher); + verifyNoInteractions(reportPublisher); } @Test @@ -222,7 +222,7 @@ public class IssuePublisherTest { boolean added = moduleIssues.initAndAddIssue(issue); assertThat(added).isFalse(); - verifyZeroInteractions(reportPublisher); + verifyNoInteractions(reportPublisher); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/ModuleSensorsExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/ModuleSensorsExecutorTest.java index c6c7ab05fd5..2b3658f3157 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/ModuleSensorsExecutorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/ModuleSensorsExecutorTest.java @@ -53,8 +53,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; @RunWith(DataProviderRunner.class) @@ -113,7 +113,7 @@ public class ModuleSensorsExecutorTest { verify(perModuleSensor).analyse(); verify(perModuleSensor).wrappedSensor(); - verifyZeroInteractions(globalSensor); + verifyNoInteractions(globalSensor); verifyNoMoreInteractions(perModuleSensor, globalSensor); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java index 1b0841f68d8..54561735cee 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java @@ -48,7 +48,7 @@ import org.sonar.updatecenter.common.Version; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class AnalysisContextReportPublisherTest { @@ -99,7 +99,7 @@ public class AnalysisContextReportPublisherTest { assertThat(writer.getFileStructure().analysisLog()).exists(); assertThat(FileUtils.readFileToString(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8)).contains("Xoo 1.0 (xoo)"); - verifyZeroInteractions(system2); + verifyNoInteractions(system2); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java index e8383c54f73..0c6e5d2c2cc 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java @@ -47,7 +47,7 @@ import org.sonar.scanner.scm.ScmConfiguration; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assumptions.assumeThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class ChangedLinesPublisherTest { @@ -85,7 +85,7 @@ public class ChangedLinesPublisherTest { public void skip_if_scm_is_disabled() { when(scmConfiguration.isDisabled()).thenReturn(true); publisher.publish(writer); - verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider); + verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider); assertNotPublished(); } @@ -93,7 +93,7 @@ public class ChangedLinesPublisherTest { public void skip_if_not_pr() { when(branchConfiguration.isPullRequest()).thenReturn(false); publisher.publish(writer); - verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider); + verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider); assertNotPublished(); } @@ -101,7 +101,7 @@ public class ChangedLinesPublisherTest { public void skip_if_target_branch_is_null() { when(branchConfiguration.targetBranchName()).thenReturn(null); publisher.publish(writer); - verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider); + verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider); assertNotPublished(); } @@ -109,7 +109,7 @@ public class ChangedLinesPublisherTest { public void skip_if_no_scm_provider() { when(scmConfiguration.provider()).thenReturn(null); publisher.publish(writer); - verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider); + verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider); assertNotPublished(); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java index d8c1576c289..ec319e1c931 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class ScmChangedFilesProviderTest { @@ -100,7 +100,7 @@ public class ScmChangedFilesProviderTest { ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project); assertThat(scmChangedFiles.get()).isNull(); - verifyZeroInteractions(scmConfiguration); + verifyNoInteractions(scmConfiguration); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java index 6cbde59679d..bb5d8f78bea 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java @@ -65,8 +65,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.data.MapEntry.entry; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class DefaultSensorStorageTest { @@ -201,7 +201,7 @@ public class DefaultSensorStorageTest { DefaultIssue issue = new DefaultIssue(project).at(new DefaultIssueLocation().on(file)); underTest.store(issue); - verifyZeroInteractions(moduleIssues); + verifyNoInteractions(moduleIssues); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/JGitBlameCommandTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/JGitBlameCommandTest.java index be64c480015..6ceb80baf7f 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/JGitBlameCommandTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/JGitBlameCommandTest.java @@ -52,10 +52,10 @@ import org.sonar.api.utils.log.LogTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assume.assumeTrue; -import static org.mockito.Matchers.startsWith; +import static org.mockito.ArgumentMatchers.startsWith; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.sonar.scm.git.Utils.javaUnzip; @@ -291,7 +291,7 @@ public class JGitBlameCommandTest { assertThat(logTester.logs()).first() .matches(s -> s.contains("Shallow clone detected, no blame information will be provided.")); - verifyZeroInteractions(output); + verifyNoInteractions(output); verify(analysisWarnings).addUnique(startsWith("Shallow clone detected")); } @@ -322,7 +322,7 @@ public class JGitBlameCommandTest { assertThat(output.blame).containsKey(inputFile); assertThat(output.blame.get(inputFile).stream().map(BlameLine::revision)) .containsOnly("6b3aab35a3ea32c1636fee56f996e677653c48ea", "843c7c30d7ebd9a479e8f1daead91036c75cbc4e", "0d269c1acfb8e6d4d33f3c43041eb87e0df0f5e7"); - verifyZeroInteractions(analysisWarnings); + verifyNoInteractions(analysisWarnings); } private File createNewTempFolder() throws IOException { -- 2.39.5