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'
}
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') {
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);
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;
underTest.visit(ReportComponent.builder(PROJECT, 1).build());
- verifyZeroInteractions(issueLifecycle);
+ verifyNoInteractions(issueLifecycle);
CloseableIterator<DefaultIssue> issues = protoIssueCache.traverse();
assertThat(issues.hasNext()).isFalse();
}
public void do_nothing_on_directory() {
underTest.visit(ReportComponent.builder(DIRECTORY, 1).build());
- verifyZeroInteractions(issueLifecycle);
+ verifyNoInteractions(issueLifecycle);
CloseableIterator<DefaultIssue> issues = protoIssueCache.traverse();
assertThat(issues.hasNext()).isFalse();
}
public void do_nothing_on_file() {
underTest.visit(ReportComponent.builder(FILE, 1).build());
- verifyZeroInteractions(issueLifecycle);
+ verifyNoInteractions(issueLifecycle);
CloseableIterator<DefaultIssue> issues = protoIssueCache.traverse();
assertThat(issues.hasNext()).isFalse();
}
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 {
Input<DefaultIssue> input = underTest.create(component);
- verifyZeroInteractions(dbClient, issuesLoader);
+ verifyNoInteractions(dbClient, issuesLoader);
List<DefaultIssue> issues = ImmutableList.of(new DefaultIssue(), new DefaultIssue());
when(issuesLoader.loadClosedIssues(componentUuid)).thenReturn(issues);
Input<DefaultIssue> input = underTest.create(component);
- verifyZeroInteractions(dbClient, issuesLoader);
+ verifyNoInteractions(dbClient, issuesLoader);
List<DefaultIssue> issues = ImmutableList.of();
when(issuesLoader.loadClosedIssues(originalComponentUuid)).thenReturn(issues);
Input<DefaultIssue> input = underTest.create(component);
- verifyZeroInteractions(dbClient, issuesLoader);
+ verifyNoInteractions(dbClient, issuesLoader);
List<DefaultIssue> issues = ImmutableList.of(new DefaultIssue());
when(issuesLoader.loadClosedIssues(componentUuid)).thenReturn(issues);
reset(issuesLoader);
assertThat(input.getIssues()).isSameAs(issues);
- verifyZeroInteractions(issuesLoader);
+ verifyNoInteractions(issuesLoader);
}
}
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;
assertThat(underTest.loadClosedIssues(componentUuid)).isEmpty();
- verifyZeroInteractions(dbClient, system2);
+ verifyNoInteractions(dbClient, system2);
}
@Test
underTest.loadLatestDiffChangesForReopeningOfClosedIssues(emptyList());
- verifyZeroInteractions(dbClient, system2);
+ verifyNoInteractions(dbClient, system2);
}
@Test
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;
run();
assertChangeOfCreationDateTo(expectedDate);
- verifyZeroInteractions(activeRulesHolder);
+ verifyNoInteractions(activeRulesHolder);
}
@DataProvider
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;
underTest.visit(ReportComponent.builder(DIRECTORY, 1).build());
underTest.visit(ReportComponent.builder(FILE, 1).build());
- verifyZeroInteractions(componentsWithUnprocessedIssues);
+ verifyNoInteractions(componentsWithUnprocessedIssues);
}
}
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 {
DefaultIssue issue = mock(DefaultIssue.class);
underTest.onIssue(ReportComponent.builder(Component.Type.DIRECTORY, 1).build(), issue);
- verifyZeroInteractions(issue);
+ verifyNoInteractions(issue);
}
@Test
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;
Collection<DefaultIssue> issues = underTest.process(file);
assertThat(issues).isEmpty();
- verifyZeroInteractions(rule1, rule2);
+ verifyNoInteractions(rule1, rule2);
}
@Test
Collection<DefaultIssue> issues = underTest.process(DUMB_PROJECT);
assertThat(issues).isEmpty();
- verifyZeroInteractions(rule1, rule2);
+ verifyNoInteractions(rule1, rule2);
}
}
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;
underTestWithMock.getBaseMeasure(null, metric1);
fail("an NPE should have been raised");
} catch (NullPointerException e) {
- verifyZeroInteractions(mockedDbClient);
+ verifyNoInteractions(mockedDbClient);
}
}
underTestWithMock.getBaseMeasure(FILE_COMPONENT, null);
fail("an NPE should have been raised");
} catch (NullPointerException e) {
- verifyZeroInteractions(mockedDbClient);
+ verifyNoInteractions(mockedDbClient);
}
}
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;
int deliver = underTest.deliver(Collections.emptyList());
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager, emailNotificationChannel);
+ verifyNoInteractions(notificationManager, emailNotificationChannel);
}
@Test
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
int deliver = underTest.deliver(notifications);
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
notifications.forEach(notification -> {
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;
underTest.getScmInfo(FILE);
assertThat(logTester.logs(TRACE)).isEmpty();
- verifyZeroInteractions(dbLoader);
- verifyZeroInteractions(sourceHashRepository);
- verifyZeroInteractions(diff);
+ verifyNoInteractions(dbLoader);
+ verifyNoInteractions(sourceHashRepository);
+ verifyNoInteractions(diff);
}
@Test
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
verifyNoMoreInteractions(dbLoader);
verifyNoMoreInteractions(sourceHashRepository);
- verifyZeroInteractions(diff);
+ verifyNoInteractions(diff);
}
@Test
verifyNoMoreInteractions(dbLoader);
verifyNoMoreInteractions(sourceHashRepository);
- verifyZeroInteractions(diff);
+ verifyNoInteractions(diff);
}
@Test
verify(dbLoader).getScmInfo(FILE);
verifyNoMoreInteractions(dbLoader);
- verifyZeroInteractions(sourceHashRepository);
- verifyZeroInteractions(diff);
+ verifyNoInteractions(sourceHashRepository);
+ verifyNoInteractions(diff);
}
@Test
verify(dbLoader).getScmInfo(FILE);
verifyNoMoreInteractions(dbLoader);
- verifyZeroInteractions(sourceHashRepository);
- verifyZeroInteractions(diff);
+ verifyNoInteractions(sourceHashRepository);
+ verifyNoInteractions(diff);
}
@Test
verify(dbLoader).getScmInfo(FILE);
verify(diff).computeMatchingLines(FILE);
verifyNoMoreInteractions(dbLoader);
- verifyZeroInteractions(sourceHashRepository);
+ verifyNoInteractions(sourceHashRepository);
verifyNoMoreInteractions(diff);
}
assertThat(underTest.getScmInfo(component)).isEmpty();
- verifyZeroInteractions(batchReportReader, dbLoader);
+ verifyNoInteractions(batchReportReader, dbLoader);
}
@DataProvider
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;
underTest.addWarning(file, readError);
- verifyZeroInteractions(taskMessages);
+ verifyNoInteractions(taskMessages);
underTest.commitWarnings();
Arrays.stream(readErrors).forEach(readError -> underTest.addWarning(file, readError));
- verifyZeroInteractions(taskMessages);
+ verifyNoInteractions(taskMessages);
underTest.commitWarnings();
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();
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();
underTest.addWarning(file, readError);
- verifyZeroInteractions(taskMessages);
+ verifyNoInteractions(taskMessages);
underTest.commitWarnings();
Arrays.stream(readErrors).forEach(readError -> underTest.addWarning(file, readError));
- verifyZeroInteractions(taskMessages);
+ verifyNoInteractions(taskMessages);
underTest.commitWarnings();
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();
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();
underTest.addWarning(file, readError);
- verifyZeroInteractions(taskMessages);
+ verifyNoInteractions(taskMessages);
underTest.commitWarnings();
- verifyZeroInteractions(taskMessages);
+ verifyNoInteractions(taskMessages);
}
@DataProvider
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 {
verify(c1).close();
verify(c2).close();
verifyNoMoreInteractions(c1, c2);
- verifyZeroInteractions(r1, r2);
+ verifyNoInteractions(r1, r2);
}
@Test
verify(r1).read(builder);
verify(r2).read(builder);
verifyNoMoreInteractions(r1, r2);
- verifyZeroInteractions(c1, c2);
+ verifyNoInteractions(c1, c2);
}
@Test
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 {
verify(significantCodeRepository).getRangesPerLine(file);
verifyNoMoreInteractions(significantCodeRepository);
- verifyZeroInteractions(dbLineHashVersion);
+ verifyNoInteractions(dbLineHashVersion);
}
@Test
verify(significantCodeRepository).getRangesPerLine(file);
verifyNoMoreInteractions(significantCodeRepository);
- verifyZeroInteractions(dbLineHashVersion);
+ verifyNoInteractions(dbLineHashVersion);
}
@Test
assertLineHashes(lineHashes, "line1", "line2", "line3");
verify(dbLineHashVersion).hasLineHashesWithoutSignificantCode(file);
verifyNoMoreInteractions(dbLineHashVersion);
- verifyZeroInteractions(significantCodeRepository);
+ verifyNoInteractions(significantCodeRepository);
}
@Test
verify(significantCodeRepository).getRangesPerLine(file);
verifyNoMoreInteractions(significantCodeRepository);
- verifyZeroInteractions(dbLineHashVersion);
+ verifyNoInteractions(dbLineHashVersion);
}
@Test
verify(significantCodeRepository).getRangesPerLine(file);
verifyNoMoreInteractions(significantCodeRepository);
- verifyZeroInteractions(dbLineHashVersion);
+ verifyNoInteractions(dbLineHashVersion);
}
@Test
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;
underTest.execute(new TestComputationStepContext());
- verifyZeroInteractions(integrateCrossProjectDuplications);
+ verifyNoInteractions(integrateCrossProjectDuplications);
}
@Test
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;
underTest.execute(new TestComputationStepContext());
- verifyZeroInteractions(uuidFactory, reportReader, treeRootHolder, dbClient);
+ verifyNoInteractions(uuidFactory, reportReader, treeRootHolder, dbClient);
}
@Test
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;
underTest.execute(new TestComputationStepContext());
- verifyZeroInteractions(treeRootHolder, metricRepository, measureRepository, eventRepository, notificationService);
+ verifyNoInteractions(treeRootHolder, metricRepository, measureRepository, eventRepository, notificationService);
}
}
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;
TestComputationStepContext context = new TestComputationStepContext();
underTest.execute(context);
- verifyZeroInteractions(notificationService, newIssuesNotificationMock);
+ verifyNoInteractions(notificationService, newIssuesNotificationMock);
}
private DefaultIssue createIssue() {
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 {
underTest.execute(new TestComputationStepContext());
- verifyZeroInteractions(analysisMetadataHolder);
+ verifyNoInteractions(analysisMetadataHolder);
}
@Test
underTest.execute(new TestComputationStepContext());
- verifyZeroInteractions(analysisMetadataHolder);
+ verifyNoInteractions(analysisMetadataHolder);
}
@Test
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;
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 {
underTest.addAll(Collections.emptyList());
- verifyZeroInteractions(dbClientMock, uuidFactoryMock, ceTaskMock);
+ verifyNoInteractions(dbClientMock, uuidFactoryMock, ceTaskMock);
}
@Test
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));
public void getPendingCount_returns_0_without_querying_database() {
assertThat(underTest.getPendingCount()).isZero();
- verifyZeroInteractions(getDbClient());
+ verifyNoInteractions(getDbClient());
}
}
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;
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
fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, throwableMock);
- verifyZeroInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2);
+ verifyNoInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2);
}
@Test
fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, throwableMock);
- verifyZeroInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2);
+ verifyNoInteractions(ceTaskResultMock, throwableMock, notificationService, dbClientMock, serializer, system2);
}
@Test
fullMockedUnderTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, throwableMock);
- verifyZeroInteractions(ceTaskResultMock, throwableMock, dbClientMock, serializer, system2);
+ verifyNoInteractions(ceTaskResultMock, throwableMock, dbClientMock, serializer, system2);
}
@Test
underTest.onEnd(ceTaskMock, CeActivityDto.Status.FAILED, randomDuration(), ceTaskResultMock, null);
verify(notificationService).deliver(same(notificationMock));
- verifyZeroInteractions(ceTaskResultMock);
+ verifyNoInteractions(ceTaskResultMock);
}
@Test
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;
public void stop_has_no_effect() {
underTest.stop();
- verifyZeroInteractions(databaseVersion);
+ verifyNoInteractions(databaseVersion);
}
}
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 {
underTest.onServerStart(server);
- verifyZeroInteractions(processingScheduler, cleaningScheduler);
+ verifyNoInteractions(processingScheduler, cleaningScheduler);
}
}
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;
underTest.cancelWornOuts();
assertThat(db.getDbClient().ceActivityDao().selectByUuid(db.getSession(), task.getUuid())).isPresent();
- verifyZeroInteractions(queueStatusMock);
+ verifyNoInteractions(queueStatusMock);
}
private static class TypedExceptionImpl extends RuntimeException implements TypedException {
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;
assertThat(underTest.call()).isEqualTo(DISABLED);
- verifyZeroInteractions(taskProcessor, executionListener1, executionListener2);
+ verifyNoInteractions(taskProcessor, executionListener1, executionListener2);
}
@Test
assertThat(underTestNoListener.call()).isEqualTo(DISABLED);
- verifyZeroInteractions(taskProcessor, executionListener1, executionListener2);
+ verifyNoInteractions(taskProcessor, executionListener1, executionListener2);
}
@Test
assertThat(underTest.call()).isEqualTo(NO_TASK);
- verifyZeroInteractions(taskProcessor, executionListener1, executionListener2);
+ verifyNoInteractions(taskProcessor, executionListener1, executionListener2);
}
@Test
assertThat(underTestNoListener.call()).isEqualTo(NO_TASK);
- verifyZeroInteractions(taskProcessor, executionListener1, executionListener2);
+ verifyNoInteractions(taskProcessor, executionListener1, executionListener2);
}
@Test
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 {
underTest.onStart(ceTask);
- verifyZeroInteractions(ceTask);
+ verifyNoInteractions(ceTask);
}
@Test
underTest.onEnd(ceTask);
- verifyZeroInteractions(ceTask);
+ verifyNoInteractions(ceTask);
}
}
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;
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;
underTest.deleteNonRootComponentsInView(dbSession, Collections.emptyList());
- verifyZeroInteractions(dbSession);
+ verifyNoInteractions(dbSession);
}
@Test
Collections.shuffle(componentDtos); // order of collection must not matter
underTest.deleteNonRootComponentsInView(dbSession, componentDtos);
- verifyZeroInteractions(dbSession);
+ verifyNoInteractions(dbSession);
}
@Test
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 {
public void upgrade_does_not_verify_utf8_charset() throws Exception {
underTest.handle(connection, DatabaseCharsetChecker.State.UPGRADE);
- verifyZeroInteractions(sqlExecutor);
+ verifyNoInteractions(sqlExecutor);
}
@Test
@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 {
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 {
underTest.handle(connection, DatabaseCharsetChecker.State.FRESH_INSTALL);
// no errors, charset has been verified
verify(metadata).getDefaultCharset(same(connection));
- verifyZeroInteractions(sqlExecutor);
+ verifyNoInteractions(sqlExecutor);
}
@Test
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 {
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
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");
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;
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");
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]");
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;
underTest.stop();
verify(sharedHealthState).clearMine();
- verifyZeroInteractions(executorService, nodeHealthProvider);
+ verifyNoInteractions(executorService, nodeHealthProvider);
}
@Test
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;
underTest.buildTopAggregation(topAggregationName, topAggregation, NO_EXTRA_FILTER, t -> t.subAggregation(subAggregation));
- verifyZeroInteractions(subAggregationHelper);
+ verifyNoInteractions(subAggregationHelper);
}
@Test
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;
int deliver = underTest.deliver(Collections.emptyList());
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager, emailNotificationChannel);
+ verifyNoInteractions(notificationManager, emailNotificationChannel);
}
@Test
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
int deliver = underTest.deliver(ImmutableSet.of(serializer.serialize(builder)));
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
}
int deliver = underTest.deliver(notifications);
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
}
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;
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
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);
}
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);
}
verifyNoMoreInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
- verifyZeroInteractions(changeMock);
+ verifyNoInteractions(changeMock);
}
@Test
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;
int deliver = underTest.deliver(Collections.emptyList());
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager, emailNotificationChannel);
+ verifyNoInteractions(notificationManager, emailNotificationChannel);
}
@Test
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
int deliver = underTest.deliver(notifications);
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
notifications.forEach(notification -> {
int deliver = underTest.deliver(notifications);
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
notifications.forEach(notification -> {
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;
int deliver = underTest.deliver(Collections.emptyList());
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager, emailNotificationChannel);
+ verifyNoInteractions(notificationManager, emailNotificationChannel);
}
@Test
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
int deliver = underTest.deliver(notifications);
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
notifications.forEach(notification -> {
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 {
NotificationService underTest = new NotificationService(dbClient);
assertThat(underTest.deliverEmails(notifications)).isZero();
- verifyZeroInteractions(dbClient);
+ verifyNoInteractions(dbClient);
}
@Test
NotificationService underTest = new NotificationService(dbClient, new NotificationDispatcher[] {dispatcher});
assertThat(underTest.deliverEmails(notifications)).isZero();
- verifyZeroInteractions(dispatcher);
- verifyZeroInteractions(dbClient);
+ verifyNoInteractions(dispatcher);
+ verifyNoInteractions(dbClient);
}
@Test
new NotificationHandler[] {handler1, handler2});
assertThat(underTest.deliverEmails(Collections.emptyList())).isZero();
- verifyZeroInteractions(handler1, handler2);
+ verifyNoInteractions(handler1, handler2);
}
@Test
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;
int deliver = underTest.deliver(Collections.emptyList());
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager, emailNotificationChannel);
+ verifyNoInteractions(notificationManager, emailNotificationChannel);
}
@Test
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
int deliver = underTest.deliver(notifications);
assertThat(deliver).isZero();
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
notifications.forEach(notification -> {
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 {
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
underTest.broadcastOnIssueChange(oneIssueOnComponent1, singletonList(component1QGChangeEvent));
- verifyZeroInteractions(listener1, listener2, listener3);
+ verifyNoInteractions(listener1, listener2, listener3);
}
@Test
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;
public void does_not_authenticate_when_no_authorization_header() {
underTest.authenticate(request);
- verifyZeroInteractions(credentialsAuthentication, authenticationEvent);
+ verifyNoInteractions(credentialsAuthentication, authenticationEvent);
}
@Test
underTest.authenticate(request);
- verifyZeroInteractions(credentialsAuthentication, authenticationEvent);
+ verifyNoInteractions(credentialsAuthentication, authenticationEvent);
}
@Test
.isInstanceOf(AuthenticationException.class)
.hasFieldOrPropertyWithValue("source", Source.local(BASIC));
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
.isInstanceOf(AuthenticationException.class)
.hasFieldOrPropertyWithValue("source", Source.local(BASIC_TOKEN));
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
.isInstanceOf(AuthenticationException.class)
.hasFieldOrPropertyWithValue("source", Source.local(BASIC_TOKEN));
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
.isInstanceOf(AuthenticationException.class)
.hasFieldOrPropertyWithValue("source", Source.local(BASIC_TOKEN));
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
private static String toBase64(String text) {
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;
.hasFieldOrPropertyWithValue("source", Source.realm(BASIC, REALM_NAME))
.hasFieldOrPropertyWithValue("login", LOGIN);
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
.hasFieldOrPropertyWithValue("source", Source.realm(BASIC, REALM_NAME))
.hasFieldOrPropertyWithValue("login", LOGIN);
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
.hasFieldOrPropertyWithValue("source", Source.realm(BASIC_TOKEN, REALM_NAME))
.hasFieldOrPropertyWithValue("login", LOGIN);
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
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;
// User is not updated
verifyUserInDb(DEFAULT_LOGIN, DEFAULT_NAME, DEFAULT_EMAIL, group1);
verifyTokenIsNotUpdated();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
// User is not updated
verifyUserInDb(DEFAULT_LOGIN, DEFAULT_NAME, DEFAULT_EMAIL, group1);
verifyTokenIsNotUpdated();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
verifyUserNotAuthenticated();
verifyTokenIsNotUpdated();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
underTest.authenticate(createRequest(DEFAULT_LOGIN, DEFAULT_NAME, DEFAULT_EMAIL, GROUPS), response);
verifyUserNotAuthenticated();
- verifyZeroInteractions(jwtHttpHandler, authenticationEvent);
+ verifyNoInteractions(jwtHttpHandler, authenticationEvent);
}
@Test
.isInstanceOf(AuthenticationException.class)
.hasFieldOrPropertyWithValue("source", Source.sso());
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
private void startWithSso() {
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 {
underTest.doFilter(request, response, chain);
assertOAuth2InitCalled();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
underTest.doFilter(request, response, chain);
assertOAuth2InitCalled();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
underTest.doFilter(request, response, chain);
assertBasicInitCalled();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
underTest.doFilter(request, response, chain);
assertError("No provider key found in URI");
- verifyZeroInteractions(authenticationEvent);
- verifyZeroInteractions(auth2AuthenticationParameters);
+ verifyNoInteractions(authenticationEvent);
+ verifyNoInteractions(auth2AuthenticationParameters);
}
@Test
underTest.doFilter(request, response, chain);
assertError("No provider key found in URI");
- verifyZeroInteractions(authenticationEvent);
- verifyZeroInteractions(auth2AuthenticationParameters);
+ verifyNoInteractions(authenticationEvent);
+ verifyNoInteractions(auth2AuthenticationParameters);
}
@Test
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
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;
underTest.doFilter(request, response, chain);
assertError("Not an OAuth2IdentityProvider: class org.sonar.server.authentication.FakeBasicIdentityProvider");
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
underTest.doFilter(request, response, chain);
assertError("Failed to retrieve IdentityProvider for key 'github'");
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
underTest.doFilter(request, response, chain);
assertError("No provider key found in URI");
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
private void assertCallbackCalled(FakeOAuth2IdentityProvider oAuth2IdentityProvider) {
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;
underTest.loginSuccess(request, "login", Source.sso());
- verifyZeroInteractions(request);
+ verifyNoInteractions(request);
}
@Test
underTest.loginFailure(request, exception);
- verifyZeroInteractions(request, exception);
+ verifyNoInteractions(request, exception);
}
@Test
underTest.logoutSuccess(request, "foo");
- verifyZeroInteractions(request);
+ verifyNoInteractions(request);
}
@Test
underTest.logoutFailure(request, "bad csrf");
- verifyZeroInteractions(request);
+ verifyNoInteractions(request);
}
@Test
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)
int count = underTest.deliverAll(Collections.emptySet());
assertThat(count).isZero();
- verifyZeroInteractions(emailSettings);
+ verifyNoInteractions(emailSettings);
assertThat(smtpServer.getMessages()).isEmpty();
}
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 {
underTest.start();
- verifyZeroInteractions(migrationEngine);
+ verifyNoInteractions(migrationEngine);
assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty();
}
underTest.start();
- verifyZeroInteractions(migrationEngine);
+ verifyNoInteractions(migrationEngine);
assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty();
}
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;
mockedUnderTest.onIssueChanges(qualityGateEvent, CHANGED_ISSUES_ARE_IGNORED);
verify(webHooks).isEnabled(qualityGateEvent.getProject());
- verifyZeroInteractions(webhookPayloadFactory, mockedDbClient);
+ verifyNoInteractions(webhookPayloadFactory, mockedDbClient);
}
@DataProvider
underTest.onIssueChanges(qualityGateEvent, CHANGED_ISSUES_ARE_IGNORED);
- verifyZeroInteractions(webhookPayloadFactory, mockedDbClient);
+ verifyNoInteractions(webhookPayloadFactory, mockedDbClient);
}
@Test
underTest.onIssueChanges(qualityGateEvent, CHANGED_ISSUES_ARE_IGNORED);
- verifyZeroInteractions(webhookPayloadFactory, mockedDbClient);
+ verifyNoInteractions(webhookPayloadFactory, mockedDbClient);
}
@Test
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;
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
underTest.doFilter(request, response, chain);
- verifyZeroInteractions(credentialsAuthentication, jwtHttpHandler, chain);
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(credentialsAuthentication, jwtHttpHandler, chain);
+ verifyNoInteractions(authenticationEvent);
}
@Test
verify(response).setStatus(401);
assertThat(threadLocalUserSession.hasSession()).isFalse();
- verifyZeroInteractions(authenticationEvent);
+ verifyNoInteractions(authenticationEvent);
}
@Test
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;
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 {
assertThatThrownBy(() -> {
call();
- verifyZeroInteractions(queue);
+ verifyNoInteractions(queue);
})
.isInstanceOf(ForbiddenException.class)
.hasMessage("Insufficient privileges");
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 {
} catch (Exception e) {
assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Missing parameter : 'comment'");
}
- verifyZeroInteractions(issueUpdater);
+ verifyNoInteractions(issueUpdater);
}
@Test
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;
underTest.saveIssueAndPreloadSearchResponseData(db.getSession(), issue, context, false);
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
}
@Test
underTest.saveIssueAndPreloadSearchResponseData(db.getSession(), issue, context, false);
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
}
@Test
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;
TestResponse result = call(null, DateUtils.formatDateTime(aBitLater));
- verifyZeroInteractions(i18n);
+ verifyNoInteractions(i18n);
verify(server).getStartedAt();
assertThat(result.getStatus()).isEqualTo(HttpURLConnection.HTTP_NOT_MODIFIED);
}
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;
String response = tester.newRequest().execute().getInput();
- verifyZeroInteractions(updateCenterMatrixFactory);
+ verifyNoInteractions(updateCenterMatrixFactory);
assertJson(response).isSimilarTo(
"{" +
" \"plugins\":" +
String response = tester.newRequest().execute().getInput();
- verifyZeroInteractions(updateCenterMatrixFactory);
+ verifyNoInteractions(updateCenterMatrixFactory);
assertJson(response)
.isSimilarTo("{" +
" \"plugins\":" +
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 {
fail();
} catch (IllegalArgumentException e) {
assertThat(e).hasMessage("Source and target profiles are equal: " + source.getName());
- verifyZeroInteractions(backuper);
+ verifyNoInteractions(backuper);
}
}
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 {
underTest.delete(dbSession, Collections.emptyList());
- verifyZeroInteractions(activeRuleIndexer);
+ verifyNoInteractions(activeRuleIndexer);
assertQualityProfileFromDb(profile).isNotNull();
}
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;
underTest.start();
- verifyZeroInteractions(builtInQualityProfilesNotification);
+ verifyNoInteractions(builtInQualityProfilesNotification);
}
@Test
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 {
assertThat(deliver).isZero();
verify(emailNotificationChannel).isActivated();
verifyNoMoreInteractions(emailNotificationChannel);
- verifyZeroInteractions(dbClient);
- notifications.forEach(Mockito::verifyZeroInteractions);
+ verifyNoInteractions(dbClient);
+ notifications.forEach(Mockito::verifyNoInteractions);
}
@Test
verifyNoMoreInteractions(dbClient);
verify(authorizationDao).selectQualityProfileAdministratorLogins(dbSession);
verifyNoMoreInteractions(authorizationDao);
- notifications.forEach(Mockito::verifyZeroInteractions);
+ notifications.forEach(Mockito::verifyNoInteractions);
}
@Test
verifyNoMoreInteractions(dbClient);
verify(authorizationDao).selectQualityProfileAdministratorLogins(dbSession);
verifyNoMoreInteractions(authorizationDao);
- notifications.forEach(Mockito::verifyZeroInteractions);
+ notifications.forEach(Mockito::verifyNoInteractions);
}
}
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;
BuiltInQualityProfilesUpdateListener underTest = new BuiltInQualityProfilesUpdateListener(notificationManager, languages, settings.asConfig());
underTest.onChange(profiles, 0, 1);
- verifyZeroInteractions(notificationManager);
+ verifyNoInteractions(notificationManager);
}
private Tuple addProfile(Multimap<QProfileName, ActiveRuleChange> profiles, Languages languages, ActiveRuleChange.Type type) {
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
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();
}
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 {
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);
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 {
underTest.doFilter(request, response, chain);
- verifyZeroInteractions(response);
+ verifyNoInteractions(response);
}
@Test
underTest.doFilter(request, response, chain);
- verifyZeroInteractions(response);
+ verifyNoInteractions(response);
}
private static HttpServletRequest newRequest(String path) {
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 {
underTest.doFilter(request, response, chain);
verify(response).sendRedirect(expectedRedirection);
- verifyZeroInteractions(chain);
+ verifyNoInteractions(chain);
reset(response, chain);
}
underTest.doFilter(request, response, chain);
verify(chain).doFilter(request, response);
- verifyZeroInteractions(response);
+ verifyNoInteractions(response);
reset(response, chain);
}
}
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 {
underTest.doFilter(request, response, chain);
verify(chain).doFilter(request, response);
- verifyZeroInteractions(webPagesCache);
+ verifyNoInteractions(webPagesCache);
}
static class StringOutputStream extends ServletOutputStream {
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;
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 {
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);
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;
@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 {
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();
}
}
}
- });
+ }));
SocketAddress address = socketConnection.connect(new InetSocketAddress("localhost", 0));
baseUrl = String.format("http://%s:%d", ((InetSocketAddress) address).getAddress().getHostAddress(), ((InetSocketAddress) address).getPort());
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 {
assertThat(channel.consume(codeReader, output)).isTrue();
assertThat(codeReader.getLinePosition()).isOne();
assertThat(codeReader.getColumnPosition()).isEqualTo(3);
- verifyZeroInteractions(output);
+ verifyNoInteractions(output);
}
}
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;
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));
}
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);
tokens.save();
- verifyZeroInteractions(sensorStorage);
+ verifyNoInteractions(sensorStorage);
assertThat(tokens.getTokenLines()).isEmpty();
}
.addToken(testInputFile.newRange(1, 2, 1, 5), "foo");
tokens.save();
- verifyZeroInteractions(sensorStorage);
+ verifyNoInteractions(sensorStorage);
assertThat(tokens.getTokenLines()).isEmpty();
}
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 {
underTest.debug("message {}", "foo");
underTest.debug("message {} {}", "foo", "bar");
underTest.debug("message {} {} {}", "foo", "bar", "baz");
- verifyZeroInteractions(stream);
+ verifyNoInteractions(stream);
}
@Test
underTest.trace("message {}", "foo");
underTest.trace("message {} {}", "foo", "bar");
underTest.trace("message {} {} {}", "foo", "bar", "baz");
- verifyZeroInteractions(stream);
+ verifyNoInteractions(stream);
}
@Test
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 {
public void testExclusions() {
file.setExcludedForDuplication(true);
new JavaCpdBlockIndexerSensor(index).execute(context);
- verifyZeroInteractions(index);
+ verifyNoInteractions(index);
}
@Test
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;
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)
boolean added = moduleIssues.initAndAddIssue(issue);
assertThat(added).isFalse();
- verifyZeroInteractions(reportPublisher);
+ verifyNoInteractions(reportPublisher);
}
@Test
boolean added = moduleIssues.initAndAddIssue(issue);
assertThat(added).isFalse();
- verifyZeroInteractions(reportPublisher);
+ verifyNoInteractions(reportPublisher);
}
@Test
boolean added = moduleIssues.initAndAddIssue(issue);
assertThat(added).isFalse();
- verifyZeroInteractions(reportPublisher);
+ verifyNoInteractions(reportPublisher);
}
@Test
boolean added = moduleIssues.initAndAddIssue(issue);
assertThat(added).isFalse();
- verifyZeroInteractions(reportPublisher);
+ verifyNoInteractions(reportPublisher);
}
@Test
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)
verify(perModuleSensor).analyse();
verify(perModuleSensor).wrappedSensor();
- verifyZeroInteractions(globalSensor);
+ verifyNoInteractions(globalSensor);
verifyNoMoreInteractions(perModuleSensor, globalSensor);
}
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 {
assertThat(writer.getFileStructure().analysisLog()).exists();
assertThat(FileUtils.readFileToString(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8)).contains("Xoo 1.0 (xoo)");
- verifyZeroInteractions(system2);
+ verifyNoInteractions(system2);
}
@Test
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 {
public void skip_if_scm_is_disabled() {
when(scmConfiguration.isDisabled()).thenReturn(true);
publisher.publish(writer);
- verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider);
+ verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider);
assertNotPublished();
}
public void skip_if_not_pr() {
when(branchConfiguration.isPullRequest()).thenReturn(false);
publisher.publish(writer);
- verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider);
+ verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider);
assertNotPublished();
}
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();
}
public void skip_if_no_scm_provider() {
when(scmConfiguration.provider()).thenReturn(null);
publisher.publish(writer);
- verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider);
+ verifyNoInteractions(inputComponentStore, inputModuleHierarchy, provider);
assertNotPublished();
}
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 {
ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project);
assertThat(scmChangedFiles.get()).isNull();
- verifyZeroInteractions(scmConfiguration);
+ verifyNoInteractions(scmConfiguration);
}
@Test
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 {
DefaultIssue issue = new DefaultIssue(project).at(new DefaultIssueLocation().on(file));
underTest.store(issue);
- verifyZeroInteractions(moduleIssues);
+ verifyNoInteractions(moduleIssues);
}
@Test
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;
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"));
}
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 {