@@ -83,7 +83,7 @@ public class LdapSearchTest { | |||
assertThat(search.getParameters()).isEqualTo(new String[] {"inetOrgPerson"}); | |||
assertThat(search.getReturningAttributes()).isEqualTo(new String[] {"cn"}); | |||
assertThat(search.toString()).isEqualTo("LdapSearch{baseDn=dc=example,dc=org, scope=onelevel, request=(objectClass={0}), parameters=[inetOrgPerson], attributes=[cn]}"); | |||
assertThat(enumerationToArrayList(search.find()).size()).isEqualTo(0); | |||
assertThat(enumerationToArrayList(search.find()).size()).isZero(); | |||
assertThat(search.findUnique()).isNull(); | |||
} | |||
@@ -43,7 +43,7 @@ public class MatchesByScoreTest { | |||
ScoreMatrix scoreMatrix1 = new ScoreMatrix(doesNotMatterRemovedFiles, doesNotMatterNewFiles, doesNotMatterScores, MIN_REQUIRED_SCORE - 1); | |||
MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix1); | |||
assertThat(matchesByScore.getSize()).isEqualTo(0); | |||
assertThat(matchesByScore.getSize()).isZero(); | |||
assertThat(matchesByScore).isEmpty(); | |||
ScoreMatrix scoreMatrix2 = new ScoreMatrix(doesNotMatterRemovedFiles, doesNotMatterNewFiles, doesNotMatterScores, MIN_REQUIRED_SCORE - 5); |
@@ -41,7 +41,7 @@ public class SourceSimilarityImplTest { | |||
public void zero_if_fully_different() { | |||
List<String> left = asList("a", "b", "c"); | |||
List<String> right = asList("d", "e"); | |||
assertThat(underTest.score(left, right)).isEqualTo(0); | |||
assertThat(underTest.score(left, right)).isZero(); | |||
} | |||
@Test | |||
@@ -127,6 +127,6 @@ public class SourceSimilarityImplTest { | |||
@Test | |||
public void two_empty_lists_are_not_considered_as_equal() { | |||
assertThat(underTest.score(emptyList(), emptyList())).isEqualTo(0); | |||
assertThat(underTest.score(emptyList(), emptyList())).isZero(); | |||
} | |||
} |
@@ -72,7 +72,7 @@ public class DoubleValueTest { | |||
private static void verifyUnsetVariationValue(DoubleValue variationValue) { | |||
assertThat(variationValue.isSet()).isFalse(); | |||
assertThat(variationValue.getValue()).isEqualTo(0); | |||
assertThat(variationValue.getValue()).isZero(); | |||
} | |||
private static void verifySetVariationValue(DoubleValue variationValue, double expected) { |
@@ -72,7 +72,7 @@ public class IntValueTest { | |||
private static void verifyUnsetVariationValue(IntValue variationValue) { | |||
assertThat(variationValue.isSet()).isFalse(); | |||
assertThat(variationValue.getValue()).isEqualTo(0); | |||
assertThat(variationValue.getValue()).isZero(); | |||
} | |||
private static void verifySetVariationValue(IntValue variationValue, int expected) { |
@@ -63,7 +63,7 @@ public class AdHocRuleCreatorTest { | |||
assertThat(rule.getName()).isEqualTo("eslint:no-cond-assign"); | |||
assertThat(rule.getDescription()).isNull(); | |||
assertThat(rule.getSeverity()).isNull(); | |||
assertThat(rule.getType()).isEqualTo(0); | |||
assertThat(rule.getType()).isZero(); | |||
assertThat(rule.getMetadata().getAdHocName()).isNull(); | |||
assertThat(rule.getMetadata().getAdHocDescription()).isNull(); | |||
assertThat(rule.getMetadata().getAdHocSeverity()).isNull(); | |||
@@ -91,7 +91,7 @@ public class AdHocRuleCreatorTest { | |||
assertThat(rule.getName()).isEqualTo("eslint:no-cond-assign"); | |||
assertThat(rule.getDescription()).isNull(); | |||
assertThat(rule.getSeverity()).isNull(); | |||
assertThat(rule.getType()).isEqualTo(0); | |||
assertThat(rule.getType()).isZero(); | |||
assertThat(rule.getMetadata().getAdHocName()).isEqualTo("No condition assigned"); | |||
assertThat(rule.getMetadata().getAdHocDescription()).isEqualTo("A description"); | |||
assertThat(rule.getMetadata().getAdHocSeverity()).isEqualTo(Severity.BLOCKER); | |||
@@ -146,7 +146,7 @@ public class AdHocRuleCreatorTest { | |||
assertThat(ruleUpdated.getName()).isEqualTo("eslint:no-cond-assign"); | |||
assertThat(ruleUpdated.getDescription()).isNull(); | |||
assertThat(ruleUpdated.getSeverity()).isNull(); | |||
assertThat(ruleUpdated.getType()).isEqualTo(0); | |||
assertThat(ruleUpdated.getType()).isZero(); | |||
assertThat(ruleUpdated.getMetadata().getAdHocName()).isEqualTo("No condition assigned updated"); | |||
assertThat(ruleUpdated.getMetadata().getAdHocDescription()).isEqualTo("A description updated"); | |||
assertThat(ruleUpdated.getMetadata().getAdHocSeverity()).isEqualTo(Severity.CRITICAL); |
@@ -264,7 +264,7 @@ public class IntegrateIssuesVisitorTest { | |||
underTest.visitAny(FILE); | |||
List<DefaultIssue> issues = newArrayList(protoIssueCache.traverse()); | |||
assertThat(issues).hasSize(0); | |||
assertThat(issues).isEmpty(); | |||
} | |||
@Test |
@@ -76,6 +76,6 @@ public class TrackerReferenceBranchInputFactoryTest { | |||
Input<DefaultIssue> input = underTest.create(component); | |||
assertThat(input.getIssues()).isEmpty(); | |||
assertThat(input.getLineHashSequence().length()).isEqualTo(0); | |||
assertThat(input.getLineHashSequence().length()).isZero(); | |||
} | |||
} |
@@ -103,7 +103,7 @@ public class PostMeasuresComputationChecksStepTest { | |||
ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class); | |||
verify(check).onCheck(contextArgumentCaptor.capture()); | |||
assertThat(contextArgumentCaptor.getValue().getNcloc()).isEqualTo(0); | |||
assertThat(contextArgumentCaptor.getValue().getNcloc()).isZero(); | |||
} | |||
@Test |
@@ -220,7 +220,7 @@ public class PersistFileSourcesStepTest extends BaseStepTest { | |||
assertThat(data.getLines(1).getScmRevision()).isEmpty(); | |||
assertThat(data.getLines(2).getScmAuthor()).isEmpty(); | |||
assertThat(data.getLines(2).getScmDate()).isEqualTo(0); | |||
assertThat(data.getLines(2).getScmDate()).isZero(); | |||
assertThat(data.getLines(2).getScmRevision()).isEmpty(); | |||
verify(fileSourceDataWarnings).commitWarnings(); | |||
} |
@@ -73,7 +73,7 @@ public class CoverageLineReaderTest { | |||
assertThat(computeCoverageLine.read(lineBuilder)).isEmpty(); | |||
assertThat(lineBuilder.hasLineHits()).isTrue(); | |||
assertThat(lineBuilder.getLineHits()).isEqualTo(0); | |||
assertThat(lineBuilder.getLineHits()).isZero(); | |||
} | |||
@Test |
@@ -87,7 +87,7 @@ public class PersistAdHocRulesStepTest extends BaseStepTest { | |||
assertThat(reloaded.getRepositoryKey()).isEqualTo("external_eslint"); | |||
assertThat(reloaded.isExternal()).isTrue(); | |||
assertThat(reloaded.isAdHoc()).isTrue(); | |||
assertThat(reloaded.getType()).isEqualTo(0); | |||
assertThat(reloaded.getType()).isZero(); | |||
assertThat(reloaded.getSeverity()).isNull(); | |||
assertThat(reloaded.getName()).isEqualTo("eslint:no-cond-assign"); | |||
@@ -110,7 +110,7 @@ public class PersistAnalysisPropertiesStepTest { | |||
underTest.execute(new TestComputationStepContext()); | |||
assertThat(dbTester.countRowsOfTable("analysis_properties")).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable("analysis_properties")).isZero(); | |||
} | |||
@Test | |||
@@ -121,7 +121,7 @@ public class PersistAnalysisPropertiesStepTest { | |||
underTest.execute(new TestComputationStepContext()); | |||
assertThat(dbTester.countRowsOfTable("analysis_properties")).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable("analysis_properties")).isZero(); | |||
} | |||
@Test |
@@ -141,7 +141,7 @@ public class PersistCrossProjectDuplicationIndexStepTest { | |||
TestComputationStepContext context = new TestComputationStepContext(); | |||
underTest.execute(context); | |||
assertThat(dbTester.countRowsOfTable("duplications_index")).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable("duplications_index")).isZero(); | |||
context.getStatistics().assertValue("inserts", 0); | |||
} | |||
@@ -153,7 +153,7 @@ public class PersistCrossProjectDuplicationIndexStepTest { | |||
TestComputationStepContext context = new TestComputationStepContext(); | |||
underTest.execute(context); | |||
assertThat(dbTester.countRowsOfTable("duplications_index")).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable("duplications_index")).isZero(); | |||
context.getStatistics().assertValue("inserts", null); | |||
} | |||
@@ -165,7 +165,7 @@ public class PersistDuplicationDataStepTest extends BaseStepTest { | |||
} | |||
private void assertThatNothingPersisted() { | |||
assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isZero(); | |||
} | |||
private Optional<String> selectMeasureData(String componentUuid) { |
@@ -265,7 +265,7 @@ public class QualityGateEventsStepTest { | |||
assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey()); | |||
assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName()); | |||
assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getProjectVersion()); | |||
assertThat(notification.getFieldValue("branch")).isEqualTo(null); | |||
assertThat(notification.getFieldValue("branch")).isNull(); | |||
reset(measureRepository, eventRepository, notificationService); | |||
} |
@@ -67,10 +67,10 @@ public class TaskContainerImplTest { | |||
}); | |||
ceContainer.bootup(); | |||
assertThat(defaultStartable.startCalls).isEqualTo(0); | |||
assertThat(defaultStartable.stopCalls).isEqualTo(0); | |||
assertThat(defaultStartable.startCalls).isZero(); | |||
assertThat(defaultStartable.stopCalls).isZero(); | |||
assertThat(eagerStartable.startCalls).isEqualTo(1); | |||
assertThat(eagerStartable.stopCalls).isEqualTo(0); | |||
assertThat(eagerStartable.stopCalls).isZero(); | |||
} | |||
@Test | |||
@@ -85,8 +85,8 @@ public class TaskContainerImplTest { | |||
ceContainer.close(); | |||
assertThat(defaultStartable.startCalls).isEqualTo(0); | |||
assertThat(defaultStartable.stopCalls).isEqualTo(0); | |||
assertThat(defaultStartable.startCalls).isZero(); | |||
assertThat(defaultStartable.stopCalls).isZero(); | |||
assertThat(eagerStartable.startCalls).isEqualTo(1); | |||
assertThat(eagerStartable.stopCalls).isEqualTo(1); | |||
} |
@@ -53,10 +53,10 @@ public abstract class CommonCEQueueStatusImplTest { | |||
@Test | |||
public void verify_just_created_instance_metrics() { | |||
assertThat(getUnderTest().getInProgressCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getErrorCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getSuccessCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getProcessingTime()).isEqualTo(0); | |||
assertThat(getUnderTest().getInProgressCount()).isZero(); | |||
assertThat(getUnderTest().getErrorCount()).isZero(); | |||
assertThat(getUnderTest().getSuccessCount()).isZero(); | |||
assertThat(getUnderTest().getProcessingTime()).isZero(); | |||
} | |||
@Test | |||
@@ -64,9 +64,9 @@ public abstract class CommonCEQueueStatusImplTest { | |||
getUnderTest().addInProgress(); | |||
assertThat(getUnderTest().getInProgressCount()).isEqualTo(1); | |||
assertThat(getUnderTest().getErrorCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getSuccessCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getProcessingTime()).isEqualTo(0); | |||
assertThat(getUnderTest().getErrorCount()).isZero(); | |||
assertThat(getUnderTest().getSuccessCount()).isZero(); | |||
assertThat(getUnderTest().getProcessingTime()).isZero(); | |||
} | |||
@Test | |||
@@ -77,7 +77,7 @@ public abstract class CommonCEQueueStatusImplTest { | |||
} | |||
assertThat(getUnderTest().getInProgressCount()).isEqualTo(calls); | |||
assertThat(getUnderTest().getProcessingTime()).isEqualTo(0); | |||
assertThat(getUnderTest().getProcessingTime()).isZero(); | |||
} | |||
@Test | |||
@@ -94,7 +94,7 @@ public abstract class CommonCEQueueStatusImplTest { | |||
assertThat(getUnderTest().getInProgressCount()).isEqualTo(-1); | |||
assertThat(getUnderTest().getErrorCount()).isEqualTo(1); | |||
assertThat(getUnderTest().getSuccessCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getSuccessCount()).isZero(); | |||
assertThat(getUnderTest().getProcessingTime()).isEqualTo(SOME_PROCESSING_TIME); | |||
} | |||
@@ -123,7 +123,7 @@ public abstract class CommonCEQueueStatusImplTest { | |||
getUnderTest().addSuccess(SOME_PROCESSING_TIME); | |||
assertThat(getUnderTest().getInProgressCount()).isEqualTo(-1); | |||
assertThat(getUnderTest().getErrorCount()).isEqualTo(0); | |||
assertThat(getUnderTest().getErrorCount()).isZero(); | |||
assertThat(getUnderTest().getSuccessCount()).isEqualTo(1); | |||
assertThat(getUnderTest().getProcessingTime()).isEqualTo(SOME_PROCESSING_TIME); | |||
} |
@@ -74,7 +74,7 @@ public class SqlLogFormatterTest { | |||
@Test | |||
public void countArguments() { | |||
assertThat(SqlLogFormatter.countArguments("select * from issues")).isEqualTo(0); | |||
assertThat(SqlLogFormatter.countArguments("select * from issues")).isZero(); | |||
assertThat(SqlLogFormatter.countArguments("select * from issues where id=?")).isEqualTo(1); | |||
assertThat(SqlLogFormatter.countArguments("select * from issues where id=? and kee=?")).isEqualTo(2); | |||
} |
@@ -129,7 +129,7 @@ public class CeActivityDaoTest { | |||
insertWarnings(tasks[2], 1); | |||
assertThat(underTest.selectByUuid(dbSession, tasks[0].getUuid()).get().getWarningCount()).isEqualTo(moreThan1); | |||
assertThat(underTest.selectByUuid(dbSession, tasks[1].getUuid()).get().getWarningCount()).isEqualTo(0); | |||
assertThat(underTest.selectByUuid(dbSession, tasks[1].getUuid()).get().getWarningCount()).isZero(); | |||
assertThat(underTest.selectByUuid(dbSession, tasks[2].getUuid()).get().getWarningCount()).isEqualTo(1); | |||
} | |||
@@ -246,7 +246,7 @@ public class CeQueueDaoTest { | |||
insertPending(TASK_UUID_2, MAIN_COMPONENT_UUID_1); | |||
int deletedCount = underTest.deleteByUuid(db.getSession(), "UNKNOWN"); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_1)).isPresent(); | |||
deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_1); | |||
@@ -264,15 +264,15 @@ public class CeQueueDaoTest { | |||
insertInProgress(TASK_UUID_2, MAIN_COMPONENT_UUID_1); | |||
int deletedCount = underTest.deleteByUuid(db.getSession(), "UNKNOWN", null); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_1)).isPresent(); | |||
deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_1, new DeleteIf(IN_PROGRESS)); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_1)).isPresent(); | |||
deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_2, new DeleteIf(PENDING)); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_2)).isPresent(); | |||
deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_1, new DeleteIf(PENDING)); | |||
@@ -519,7 +519,7 @@ public class CeQueueDaoTest { | |||
int total = underTest.countByQuery(db.getSession(), query); | |||
assertThat(result).isEmpty(); | |||
assertThat(total).isEqualTo(0); | |||
assertThat(total).isZero(); | |||
} | |||
@Test | |||
@@ -536,7 +536,7 @@ public class CeQueueDaoTest { | |||
int total = underTest.countByQuery(db.getSession(), query); | |||
assertThat(result).isEmpty(); | |||
assertThat(total).isEqualTo(0); | |||
assertThat(total).isZero(); | |||
} | |||
@Test | |||
@@ -553,7 +553,7 @@ public class CeQueueDaoTest { | |||
int total = underTest.countByQuery(db.getSession(), query); | |||
assertThat(result).isEmpty(); | |||
assertThat(total).isEqualTo(0); | |||
assertThat(total).isZero(); | |||
} | |||
@Test |
@@ -63,9 +63,9 @@ public class CeTaskCharacteristicDaoTest { | |||
insert("key3", "value3", "uuid3", "task3"); | |||
underTest.deleteByTaskUuids(dbTester.getSession(), ImmutableSet.of("task1", "task3")); | |||
assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task1"))).hasSize(0); | |||
assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task1"))).isEmpty(); | |||
assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task2"))).hasSize(1); | |||
assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task3"))).hasSize(0); | |||
assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task3"))).isEmpty(); | |||
} | |||
@Test |
@@ -104,7 +104,7 @@ public class CeTaskInputDaoTest { | |||
underTest.deleteByUuids(dbTester.getSession(), singleton(A_UUID)); | |||
dbTester.commit(); | |||
assertThat(dbTester.countRowsOfTable(TABLE_NAME)).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable(TABLE_NAME)).isZero(); | |||
} | |||
private void insertData(String uuid) { |
@@ -560,7 +560,7 @@ public class BranchDaoTest { | |||
@Test | |||
public void countByTypeAndCreationDate() { | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, 0L)).isEqualTo(0); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, 0L)).isZero(); | |||
ComponentDto project = db.components().insertPrivateProject(); | |||
ComponentDto branch1 = db.components().insertProjectBranch(project, b -> b.setBranchType(BranchType.BRANCH)); | |||
@@ -568,10 +568,10 @@ public class BranchDaoTest { | |||
ComponentDto pr = db.components().insertProjectBranch(project, b -> b.setBranchType(BranchType.PULL_REQUEST)); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, 0L)).isEqualTo(3); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, NOW)).isEqualTo(3); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, NOW + 100)).isEqualTo(0); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, NOW + 100)).isZero(); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, 0L)).isEqualTo(1); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, NOW)).isEqualTo(1); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, NOW + 100)).isEqualTo(0); | |||
assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, NOW + 100)).isZero(); | |||
} | |||
@Test |
@@ -1159,7 +1159,7 @@ public class ComponentDaoTest { | |||
Supplier<ComponentQuery.Builder> query = () -> ComponentQuery.builder().setOnProvisionedOnly(true); | |||
assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(PROJECT).build())).isEqualTo(1); | |||
assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(Qualifiers.VIEW).build())).isEqualTo(0); | |||
assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(Qualifiers.VIEW).build())).isZero(); | |||
assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(PROJECT, Qualifiers.VIEW).build())).isEqualTo(1); | |||
} | |||
@@ -1470,7 +1470,7 @@ public class ComponentDaoTest { | |||
assertThat(underTest.countByQuery(dbSession, organization2.getUuid(), ALL_PROJECTS_COMPONENT_QUERY)) | |||
.isEqualTo(1); | |||
assertThat(underTest.countByQuery(dbSession, "non existent organization uuid", ALL_PROJECTS_COMPONENT_QUERY)) | |||
.isEqualTo(0); | |||
.isZero(); | |||
} | |||
@Test | |||
@@ -1628,7 +1628,7 @@ public class ComponentDaoTest { | |||
int count = underTest.countByQuery(dbSession, dbQuery); | |||
assertThat(result).isEmpty(); | |||
assertThat(count).isEqualTo(0); | |||
assertThat(count).isZero(); | |||
} | |||
@Test | |||
@@ -1656,7 +1656,7 @@ public class ComponentDaoTest { | |||
int count = underTest.countByQuery(dbSession, dbQuery); | |||
assertThat(result).isEmpty(); | |||
assertThat(count).isEqualTo(0); | |||
assertThat(count).isZero(); | |||
} | |||
@Test |
@@ -160,7 +160,7 @@ public class ProjectLinkDaoTest { | |||
underTest.delete(db.getSession(), link.getUuid()); | |||
db.getSession().commit(); | |||
assertThat(db.countRowsOfTable("project_links")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable("project_links")).isZero(); | |||
} | |||
} |
@@ -139,9 +139,9 @@ public class DuplicationDaoTest { | |||
Assertions.assertThat(block.getComponentUuid()).isEqualTo(project3.uuid()); | |||
Assertions.assertThat(block.getHash()).isEqualTo("bb"); | |||
Assertions.assertThat(block.getAnalysisUuid()).isEqualTo(analysis3.getUuid()); | |||
Assertions.assertThat(block.getIndexInFile()).isEqualTo(0); | |||
Assertions.assertThat(block.getStartLine()).isEqualTo(0); | |||
Assertions.assertThat(block.getEndLine()).isEqualTo(0); | |||
Assertions.assertThat(block.getIndexInFile()).isZero(); | |||
Assertions.assertThat(block.getStartLine()).isZero(); | |||
Assertions.assertThat(block.getEndLine()).isZero(); | |||
} | |||
@Test |
@@ -81,7 +81,7 @@ public class EsQueueDaoTest { | |||
underTest.delete(dbSession, esQueueDtos); | |||
assertThat(dbTester.countSql(dbSession, "select count(*) from es_queue")).isEqualTo(0); | |||
assertThat(dbTester.countSql(dbSession, "select count(*) from es_queue")).isZero(); | |||
} | |||
@Test | |||
@@ -115,7 +115,7 @@ public class EsQueueDaoTest { | |||
system2.setNow(1_002L); | |||
EsQueueDto i3 = underTest.insert(dbSession, EsQueueDto.create("foo", UuidFactoryFast.getInstance().create())); | |||
assertThat(underTest.selectForRecovery(dbSession, 999, LIMIT)).hasSize(0); | |||
assertThat(underTest.selectForRecovery(dbSession, 999, LIMIT)).isEmpty(); | |||
assertThat(underTest.selectForRecovery(dbSession, 1_000, LIMIT)) | |||
.extracting(EsQueueDto::getUuid) | |||
.containsExactly(i1.getUuid()); |
@@ -214,7 +214,7 @@ public class EventDaoTest { | |||
underTest.delete(dbTester.getSession(), "E1"); | |||
dbTester.commit(); | |||
assertThat(dbTester.countRowsOfTable("events")).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable("events")).isZero(); | |||
} | |||
} |
@@ -269,31 +269,31 @@ public class IssueDaoTest { | |||
assertThat(result.stream().mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3); | |||
assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.BUG.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3); | |||
assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.CODE_SMELL.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.VULNERABILITY.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.CODE_SMELL.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.VULNERABILITY.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
assertThat(result.stream().filter(g -> g.getSeverity().equals("CRITICAL")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(2); | |||
assertThat(result.stream().filter(g -> g.getSeverity().equals("MAJOR")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(1); | |||
assertThat(result.stream().filter(g -> g.getSeverity().equals("MINOR")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> g.getSeverity().equals("MINOR")).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
assertThat(result.stream().filter(g -> g.getStatus().equals("OPEN")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(2); | |||
assertThat(result.stream().filter(g -> g.getStatus().equals("RESOLVED")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(1); | |||
assertThat(result.stream().filter(g -> g.getStatus().equals("CLOSED")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> g.getStatus().equals("CLOSED")).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
assertThat(result.stream().filter(g -> "FALSE-POSITIVE".equals(g.getResolution())).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(1); | |||
assertThat(result.stream().filter(g -> g.getResolution() == null).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(2); | |||
assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3); | |||
assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
// test leak | |||
result = underTest.selectIssueGroupsByBaseComponent(db.getSession(), file, 999_999_999L); | |||
assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3); | |||
// test leak using exact creation time of criticalBug2 issue | |||
result = underTest.selectIssueGroupsByBaseComponent(db.getSession(), file, criticalBug2.getIssueCreationTime()); | |||
assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0); | |||
assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isZero(); | |||
assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3); | |||
} | |||
@@ -224,7 +224,7 @@ public class IssueMapperTest { | |||
dto.setSelectedAt(1400000000000L); | |||
int count = underTest.updateIfBeforeSelectedDate(dto); | |||
assertThat(count).isEqualTo(0); | |||
assertThat(count).isZero(); | |||
dbTester.getSession().commit(); | |||
// No change |
@@ -498,7 +498,7 @@ public class LiveMeasureDaoTest { | |||
// update | |||
int count = underTest.upsert(db.getSession(), dto); | |||
assertThat(count).isEqualTo(0); | |||
assertThat(count).isZero(); | |||
verifyPersisted(dto); | |||
verifyTableSize(1); | |||
} | |||
@@ -530,7 +530,7 @@ public class LiveMeasureDaoTest { | |||
// update | |||
int count = underTest.upsert(db.getSession(), dto); | |||
assertThat(count).isEqualTo(0); | |||
assertThat(count).isZero(); | |||
verifyPersisted(dto); | |||
verifyTableSize(1); | |||
} |
@@ -59,7 +59,7 @@ public class NotificationQueueDaoTest { | |||
public void should_count_notification_queue() { | |||
NotificationQueueDto notificationQueueDto = toNotificationQueueDto(new Notification("email")); | |||
assertThat(dao.count()).isEqualTo(0); | |||
assertThat(dao.count()).isZero(); | |||
dao.insert(Arrays.asList(notificationQueueDto)); | |||
@@ -565,7 +565,7 @@ public class GroupPermissionDaoTest { | |||
underTest.deleteByRootComponentUuid(dbSession, project1.uuid()); | |||
dbSession.commit(); | |||
assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isEqualTo(0); | |||
assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isZero(); | |||
assertThat(db.countRowsOfTable("group_roles")).isEqualTo(2); | |||
} | |||
@@ -584,7 +584,7 @@ public class GroupPermissionDaoTest { | |||
underTest.deleteByRootComponentUuid(dbSession, project1.uuid()); | |||
dbSession.commit(); | |||
assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isEqualTo(0); | |||
assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isZero(); | |||
assertThat(db.countRowsOfTable("group_roles")).isEqualTo(3); | |||
} | |||
@@ -770,8 +770,8 @@ public class GroupPermissionDaoTest { | |||
public void deleteByRootComponentUuidAndGroupUuid_has_no_effect_if_component_does_not_exist() { | |||
GroupDto group = db.users().insertGroup(); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", null)).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", group.getUuid())).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", null)).isZero(); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", group.getUuid())).isZero(); | |||
} | |||
@Test | |||
@@ -779,15 +779,15 @@ public class GroupPermissionDaoTest { | |||
ComponentDto project = randomPublicOrPrivateProject(); | |||
GroupDto group = db.users().insertGroup(); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), null)).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), group.getUuid())).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), null)).isZero(); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), group.getUuid())).isZero(); | |||
} | |||
@Test | |||
public void deleteByRootComponentUuidAndGroupUuid_has_no_effect_if_group_does_not_exist() { | |||
ComponentDto project = randomPublicOrPrivateProject(); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), "5678")).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), "5678")).isZero(); | |||
} | |||
@Test | |||
@@ -804,7 +804,7 @@ public class GroupPermissionDaoTest { | |||
int deletedCount = underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), null); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, null, project.uuid())) | |||
.isEmpty(); | |||
assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, group1.getUuid(), project.uuid())) | |||
@@ -826,7 +826,7 @@ public class GroupPermissionDaoTest { | |||
int deletedCount = underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), group2.getUuid()); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, group1.getUuid(), project.uuid())) | |||
.containsOnly("p1"); | |||
assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, group2.getUuid(), project.uuid())) | |||
@@ -876,7 +876,7 @@ public class GroupPermissionDaoTest { | |||
db.users().insertPermissionOnAnyone("p1"); | |||
db.users().insertPermissionOnGroup(group, "p1"); | |||
assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isZero(); | |||
assertThat(getGlobalPermissionsForAnyone()).containsOnly("p1"); | |||
assertThat(getGlobalPermissionsForGroup(group)).containsOnly("p1"); | |||
@@ -893,7 +893,7 @@ public class GroupPermissionDaoTest { | |||
db.users().insertProjectPermissionOnGroup(group, "p1", project); | |||
db.users().insertProjectPermissionOnAnyone("p1", project); | |||
assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, "1324", "p1")).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, "1324", "p1")).isZero(); | |||
assertThat(getGlobalPermissionsForAnyone()).containsOnly("p1"); | |||
assertThat(getGlobalPermissionsForGroup(group)).containsOnly("p1"); | |||
@@ -908,7 +908,7 @@ public class GroupPermissionDaoTest { | |||
db.users().insertPermissionOnAnyone("p1"); | |||
db.users().insertPermissionOnGroup(group, "p1"); | |||
assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isEqualTo(0); | |||
assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isZero(); | |||
} | |||
private Collection<String> getGlobalPermissionsForAnyone() { | |||
@@ -945,7 +945,7 @@ public class GroupPermissionDaoTest { | |||
} | |||
private void assertThatNoPermission(String permission) { | |||
assertThat(db.countSql("select count(uuid) from group_roles where role='" + permission + "'")).isEqualTo(0); | |||
assertThat(db.countSql("select count(uuid) from group_roles where role='" + permission + "'")).isZero(); | |||
} | |||
} |
@@ -65,7 +65,7 @@ public class PermissionQueryTest { | |||
PermissionQuery query = PermissionQuery.builder() | |||
.build(); | |||
assertThat(query.getPageOffset()).isEqualTo(0); | |||
assertThat(query.getPageOffset()).isZero(); | |||
assertThat(query.getPageSize()).isEqualTo(20); | |||
} | |||
@@ -381,7 +381,7 @@ public class UserPermissionDaoTest { | |||
// global permission exists -> delete it, but not the project permission with the same name ! | |||
underTest.deleteGlobalPermission(dbSession, user1.getUuid(), "perm1"); | |||
assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where role='perm1' and component_uuid is null")).isEqualTo(0); | |||
assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where role='perm1' and component_uuid is null")).isZero(); | |||
assertThat(db.countRowsOfTable(dbSession, "user_roles")).isEqualTo(4); | |||
} | |||
@@ -523,7 +523,7 @@ public class UserPermissionDaoTest { | |||
int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, "124", SCAN.getKey()); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey()); | |||
} | |||
@@ -535,7 +535,7 @@ public class UserPermissionDaoTest { | |||
int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, project.uuid(), SCAN.getKey()); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey()); | |||
} | |||
@@ -548,7 +548,7 @@ public class UserPermissionDaoTest { | |||
int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, project.uuid(), "p1"); | |||
assertThat(deletedCount).isEqualTo(0); | |||
assertThat(deletedCount).isZero(); | |||
assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey()); | |||
assertThat(underTest.selectProjectPermissionsOfUser(dbSession, user.getUuid(), project.uuid())).containsOnly(SCAN.getKey()); | |||
} | |||
@@ -647,11 +647,11 @@ public class UserPermissionDaoTest { | |||
private void assertThatProjectPermissionDoesNotExist(UserDto user, String permission, ComponentDto project) { | |||
assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where role='" + permission + "' and user_uuid='" + user.getUuid() | |||
+ "' and component_uuid='" + project.uuid() + "'")) | |||
.isEqualTo(0); | |||
.isZero(); | |||
} | |||
private void assertThatProjectHasNoPermissions(ComponentDto project) { | |||
assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where component_uuid='" + project.uuid() + "'")).isEqualTo(0); | |||
assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where component_uuid='" + project.uuid() + "'")).isZero(); | |||
} | |||
private void assertGlobalPermissionsOfUser(UserDto user, GlobalPermission... permissions) { |
@@ -172,7 +172,7 @@ public class ProjectDaoTest { | |||
projectDao.insert(db.getSession(), dto3); | |||
List<ProjectDto> projectsByUuids = projectDao.selectByUuids(db.getSession(), Collections.emptySet()); | |||
assertThat(projectsByUuids).hasSize(0); | |||
assertThat(projectsByUuids).isEmpty(); | |||
} | |||
private void assertProject(ProjectDto dto, String name, String kee, String org, String uuid, String desc, @Nullable String tags, boolean isPrivate) { |
@@ -165,7 +165,7 @@ public class InternalComponentPropertiesDaoTest { | |||
public void delete_by_component_uuid_and_key_does_nothing_if_property_doesnt_exist() { | |||
saveDto(); | |||
assertThat(underTest.deleteByComponentUuid(dbSession, "other_component")).isEqualTo(0); | |||
assertThat(underTest.deleteByComponentUuid(dbSession, "other_component")).isZero(); | |||
assertThat(underTest.selectByComponentUuidAndKey(dbSession, SOME_COMPONENT, SOME_KEY)).isNotEmpty(); | |||
} | |||
@@ -248,10 +248,10 @@ public class PurgeDaoTest { | |||
IssueDto openOnEnabledComponent = db.issues().insert(rule, project, enabledFile, issue -> issue.setStatus("OPEN")); | |||
IssueDto confirmOnEnabledComponent = db.issues().insert(rule, project, enabledFile, issue -> issue.setStatus("CONFIRM")); | |||
assertThat(db.countSql("select count(*) from snapshots where purge_status = 1")).isEqualTo(0); | |||
assertThat(db.countSql("select count(*) from snapshots where purge_status = 1")).isZero(); | |||
assertThat(db.countSql("select count(*) from issues where status = 'CLOSED'")).isEqualTo(0); | |||
assertThat(db.countSql("select count(*) from issues where resolution = 'REMOVED'")).isEqualTo(0); | |||
assertThat(db.countSql("select count(*) from issues where status = 'CLOSED'")).isZero(); | |||
assertThat(db.countSql("select count(*) from issues where resolution = 'REMOVED'")).isZero(); | |||
db.fileSources().insertFileSource(srcFile); | |||
FileSourceDto nonSelectedFileSource = db.fileSources().insertFileSource(enabledFile); | |||
@@ -826,7 +826,7 @@ public class PurgeDaoTest { | |||
dbSession.commit(); | |||
assertThat(db.countRowsOfTable("ce_queue")).isEqualTo(1); | |||
assertThat(db.countSql("select count(*) from ce_queue where main_component_uuid='" + projectToBeDeleted.uuid() + "'")).isEqualTo(0); | |||
assertThat(db.countSql("select count(*) from ce_queue where main_component_uuid='" + projectToBeDeleted.uuid() + "'")).isZero(); | |||
} | |||
@Test | |||
@@ -1160,7 +1160,7 @@ public class PurgeDaoTest { | |||
assertThat(selectActivity("VERY_OLD_1")).isEmpty(); | |||
assertThat(selectTaskInput("VERY_OLD_1")).isEmpty(); | |||
assertThat(selectTaskCharacteristic("VERY_OLD_1")).hasSize(0); | |||
assertThat(selectTaskCharacteristic("VERY_OLD_1")).isEmpty(); | |||
assertThat(scannerContextExists("VERY_OLD_1")).isFalse(); | |||
assertThat(selectActivity("VERY_OLD_2")).isNotEmpty(); | |||
assertThat(selectTaskInput("VERY_OLD_2")).isNotEmpty(); | |||
@@ -1169,7 +1169,7 @@ public class PurgeDaoTest { | |||
assertThat(selectActivity("JUST_OLD_ENOUGH_1")).isEmpty(); | |||
assertThat(selectTaskInput("JUST_OLD_ENOUGH_1")).isEmpty(); | |||
assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).hasSize(0); | |||
assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).isEmpty(); | |||
assertThat(scannerContextExists("JUST_OLD_ENOUGH_1")).isFalse(); | |||
assertThat(selectActivity("JUST_OLD_ENOUGH_2")).isNotEmpty(); | |||
assertThat(selectTaskInput("JUST_OLD_ENOUGH_2")).isNotEmpty(); | |||
@@ -1218,7 +1218,7 @@ public class PurgeDaoTest { | |||
assertThat(selectActivity("VERY_OLD_1")).isEmpty(); | |||
assertThat(selectTaskInput("VERY_OLD_1")).isEmpty(); | |||
assertThat(selectTaskCharacteristic("VERY_OLD_1")).hasSize(0); | |||
assertThat(selectTaskCharacteristic("VERY_OLD_1")).isEmpty(); | |||
assertThat(scannerContextExists("VERY_OLD_1")).isFalse(); | |||
assertThat(selectActivity("VERY_OLD_2")).isEmpty(); | |||
assertThat(selectTaskInput("VERY_OLD_2")).isEmpty(); | |||
@@ -1227,7 +1227,7 @@ public class PurgeDaoTest { | |||
assertThat(selectActivity("JUST_OLD_ENOUGH_1")).isEmpty(); | |||
assertThat(selectTaskInput("JUST_OLD_ENOUGH_1")).isEmpty(); | |||
assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).hasSize(0); | |||
assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).isEmpty(); | |||
assertThat(scannerContextExists("JUST_OLD_ENOUGH_1")).isFalse(); | |||
assertThat(selectActivity("JUST_OLD_ENOUGH_2")).isEmpty(); | |||
assertThat(selectTaskInput("JUST_OLD_ENOUGH_2")).isEmpty(); | |||
@@ -1561,12 +1561,12 @@ public class PurgeDaoTest { | |||
assertThat(selectActivity("VERY_OLD")).isEmpty(); | |||
assertThat(selectTaskInput("VERY_OLD")).isEmpty(); | |||
assertThat(selectTaskCharacteristic("VERY_OLD")).hasSize(0); | |||
assertThat(selectTaskCharacteristic("VERY_OLD")).isEmpty(); | |||
assertThat(scannerContextExists("VERY_OLD")).isFalse(); | |||
assertThat(selectActivity("JUST_OLD_ENOUGH")).isEmpty(); | |||
assertThat(selectTaskInput("JUST_OLD_ENOUGH")).isEmpty(); | |||
assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH")).hasSize(0); | |||
assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH")).isEmpty(); | |||
assertThat(scannerContextExists("JUST_OLD_ENOUGH")).isFalse(); | |||
assertThat(selectActivity("NOT_OLD_ENOUGH")).isNotEmpty(); |
@@ -526,7 +526,7 @@ public class ActiveRuleDaoTest { | |||
underTest.deleteParam(dbSession, param); | |||
assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, activeRule.getUuid())).hasSize(0); | |||
assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, activeRule.getUuid())).isEmpty(); | |||
} | |||
@Test | |||
@@ -593,7 +593,7 @@ public class ActiveRuleDaoTest { | |||
underTest.deleteParamsByActiveRuleUuids(dbSession, singletonList(ar1.getUuid())); | |||
assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, ar1.getUuid())).hasSize(0); | |||
assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, ar1.getUuid())).isEmpty(); | |||
assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, ar2.getUuid())).hasSize(1); | |||
} | |||
@@ -198,11 +198,11 @@ public class QProfileChangeDaoTest { | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile1.getKee()))).isEqualTo(2); | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile2.getKee()))).isEqualTo(1); | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery("does_not_exist"))).isEqualTo(0); | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery("does_not_exist"))).isZero(); | |||
QProfileChangeQuery query = new QProfileChangeQuery(profile1.getKee()); | |||
query.setToExcluded(start); | |||
assertThat(underTest.countByQuery(dbSession, query)).isEqualTo(0); | |||
assertThat(underTest.countByQuery(dbSession, query)).isZero(); | |||
QProfileChangeQuery query2 = new QProfileChangeQuery(profile1.getKee()); | |||
query2.setToExcluded(end); | |||
@@ -219,7 +219,7 @@ public class QProfileChangeDaoTest { | |||
underTest.deleteByRulesProfileUuids(dbSession, asList(profile1.getRulesProfileUuid())); | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile1.getKee()))).isEqualTo(0); | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile1.getKee()))).isZero(); | |||
assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile2.getKee()))).isEqualTo(1); | |||
} | |||
@@ -448,7 +448,7 @@ public class RuleDaoTest { | |||
assertThat(ruleDto.getRuleKey()).isEqualTo("NewRuleKey"); | |||
assertThat(ruleDto.getRepositoryKey()).isEqualTo("plugin"); | |||
assertThat(ruleDto.getConfigKey()).isEqualTo("NewConfigKey"); | |||
assertThat(ruleDto.getSeverity()).isEqualTo(0); | |||
assertThat(ruleDto.getSeverity()).isZero(); | |||
assertThat(ruleDto.getLanguage()).isEqualTo("dart"); | |||
assertThat(ruleDto.isTemplate()).isTrue(); | |||
assertThat(ruleDto.isExternal()).isTrue(); | |||
@@ -505,7 +505,7 @@ public class RuleDaoTest { | |||
assertThat(ruleDto.getRuleKey()).isEqualTo("NewRuleKey"); | |||
assertThat(ruleDto.getRepositoryKey()).isEqualTo("plugin"); | |||
assertThat(ruleDto.getConfigKey()).isEqualTo("NewConfigKey"); | |||
assertThat(ruleDto.getSeverity()).isEqualTo(0); | |||
assertThat(ruleDto.getSeverity()).isZero(); | |||
assertThat(ruleDto.getLanguage()).isEqualTo("dart"); | |||
assertThat(ruleDto.isTemplate()).isTrue(); | |||
assertThat(ruleDto.isExternal()).isTrue(); |
@@ -141,7 +141,7 @@ public class RuleRepositoryDaoTest { | |||
RuleRepositoryDto dto1 = new RuleRepositoryDto("findbugs", "java", "Findbugs"); | |||
underTest.insertOrUpdate(dbSession, asList(dto1)); | |||
assertThat(underTest.selectByLanguage(dbSession, "missing")).hasSize(0); | |||
assertThat(underTest.selectByLanguage(dbSession, "missing")).isEmpty(); | |||
} | |||
private long selectCreatedAtByKey(DbSession dbSession, String key) { |
@@ -163,7 +163,7 @@ public class FileSourceDaoTest { | |||
FileSourceDto res = underTest.selectByFileUuid(dbSession, fileSourceDto.getFileUuid()); | |||
assertThat(res.getLineCount()).isEqualTo(0); | |||
assertThat(res.getLineCount()).isZero(); | |||
assertThat(res.getLineHashes()).isEmpty(); | |||
} | |||
@@ -216,6 +216,6 @@ public class GroupDaoTest { | |||
underTest.deleteByUuid(dbSession, aGroup.getUuid()); | |||
assertThat(db.countRowsOfTable(dbSession, "groups")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(dbSession, "groups")).isZero(); | |||
} | |||
} |
@@ -214,7 +214,7 @@ public class UserDaoTest { | |||
@Test | |||
public void countRootUsersButLogin_returns_0_when_there_is_no_user_at_all() { | |||
assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0); | |||
assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero(); | |||
} | |||
@Test | |||
@@ -222,7 +222,7 @@ public class UserDaoTest { | |||
underTest.insert(session, newUserDto()); | |||
session.commit(); | |||
assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0); | |||
assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero(); | |||
} | |||
@Test | |||
@@ -231,7 +231,7 @@ public class UserDaoTest { | |||
insertInactiveRootUser(newUserDto()); | |||
session.commit(); | |||
assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0); | |||
assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero(); | |||
} | |||
@Test |
@@ -225,7 +225,7 @@ public class WebhookDeliveryDaoTest { | |||
public void deleteComponentBeforeDate_does_nothing_on_empty_table() { | |||
underTest.deleteComponentBeforeDate(dbSession, "COMPONENT_1", 1_500_000L); | |||
assertThat(dbTester.countRowsOfTable(dbSession, "webhook_deliveries")).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable(dbSession, "webhook_deliveries")).isZero(); | |||
} | |||
@Test |
@@ -48,7 +48,7 @@ public class MigrationContainerImplTest { | |||
@Test | |||
public void migration_container_lazily_instance_components() { | |||
assertThat(StartCallCounter.startCalls).isEqualTo(0); | |||
assertThat(StartCallCounter.startCalls).isZero(); | |||
StartCallCounter startCallCounter = underTest.getComponentByType(StartCallCounter.class); | |||
@@ -68,7 +68,7 @@ public class MigrationHistoryTableImplTest { | |||
} | |||
private void verifyTable() { | |||
assertThat(dbTester.countRowsOfTable(TABLE_SCHEMA_MIGRATIONS)).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable(TABLE_SCHEMA_MIGRATIONS)).isZero(); | |||
dbTester.assertColumnDefinition(TABLE_SCHEMA_MIGRATIONS, "version", Types.VARCHAR, 255, false); | |||
} | |||
} |
@@ -48,7 +48,7 @@ public class UpsertImplTest { | |||
underTest.setBatchSize(0); | |||
assertThat(underTest.getMaxBatchSize()).isEqualTo(0); | |||
assertThat(underTest.getMaxBatchSize()).isZero(); | |||
} | |||
@Test |
@@ -74,7 +74,7 @@ public class PopulateNewCodePeriodTableTest { | |||
insertProperty(0, "2019-04-05"); | |||
underTest.execute(); | |||
assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isZero(); | |||
} | |||
@Test | |||
@@ -82,7 +82,7 @@ public class PopulateNewCodePeriodTableTest { | |||
insertProperty(null, "2.0"); | |||
underTest.execute(); | |||
assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(0); | |||
assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isZero(); | |||
} | |||
@Test |
@@ -75,7 +75,7 @@ public class AddExcludeBranchFromPurgeColumnTest { | |||
} | |||
private void verifyMigrationResult() { | |||
assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = true")).isEqualTo(0); | |||
assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = true")).isZero(); | |||
assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = false")).isEqualTo(8); | |||
} | |||
@@ -126,7 +126,7 @@ public class MigrateDefaultBranchesToKeepSettingTest { | |||
private void verifyMigrationOfDefaultSetting(String expectedValue) { | |||
assertThat(dbTester.countRowsOfTable(PROPS_TABLE)).isEqualTo(4); | |||
assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.branch.longLivedBranches.regex'")).isEqualTo(0); | |||
assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.branch.longLivedBranches.regex'")).isZero(); | |||
assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'")).isEqualTo(1); | |||
assertThat(dbTester.select("select resource_id, text_value from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'") | |||
.stream() |
@@ -73,7 +73,7 @@ public class MigrateSlbsAndLlbsToCommonTypeInCeTasksTest { | |||
private void verifyMigrationResult() { | |||
assertThat(dbTester.countRowsOfTable(TABLE)).isEqualTo(8); | |||
assertThat(dbTester.countSql("select count(*) from " + TABLE + " where kee = 'branchType' and text_value in ('LONG', 'SHORT')")).isEqualTo(0); | |||
assertThat(dbTester.countSql("select count(*) from " + TABLE + " where kee = 'branchType' and text_value in ('LONG', 'SHORT')")).isZero(); | |||
assertThat(dbTester.select("select uuid from " + TABLE + " where kee = 'branchType' and text_value = 'BRANCH'") | |||
.stream() | |||
.map(e -> e.get("UUID")) |
@@ -80,7 +80,7 @@ public class MigrateSlbsAndLlbsToCommonTypeTest { | |||
private void verifyMigrationResult() { | |||
assertThat(dbTester.countRowsOfTable(BRANCHES_TABLE)).isEqualTo(8); | |||
assertThat(dbTester.countSql("select count(*) from project_branches where branch_type = 'LONG' or branch_type = 'SHORT'")).isEqualTo(0); | |||
assertThat(dbTester.countSql("select count(*) from project_branches where branch_type = 'LONG' or branch_type = 'SHORT'")).isZero(); | |||
assertThat(dbTester.select("select uuid from " + BRANCHES_TABLE + " where branch_type = 'BRANCH'") | |||
.stream() | |||
.map(e -> e.get("UUID")) |
@@ -82,7 +82,7 @@ public class RenameDaysBeforeDeletingInactiveSLBSettingTest { | |||
int numberOfPropsWithNewName = dbTester.countSql("select count(*) from " + TABLE + " where prop_key = '" + NEW_PROPERTY_NAME + "'"); | |||
int numberOfPropsWithOldName = dbTester.countSql("select count(*) from " + TABLE + " where prop_key = '" + OLD_PROPERTY_NAME + "'"); | |||
assertThat(numberOfPropsWithNewName).isEqualTo(TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES + 1); | |||
assertThat(numberOfPropsWithOldName).isEqualTo(0); | |||
assertThat(numberOfPropsWithOldName).isZero(); | |||
} | |||
private void insertProperty(@Nullable Long projectId, String propertyKey, String propertyValue) { |
@@ -55,7 +55,7 @@ public class EnsureHotspotDefaultStatusIsToReviewTest { | |||
public void does_not_fail_if_table_is_empty() throws SQLException { | |||
underTest.execute(); | |||
assertThat(db.countRowsOfTable("issues")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable("issues")).isZero(); | |||
} | |||
@Test |
@@ -104,7 +104,7 @@ public class EsLoggingTest { | |||
} | |||
private static Props newProps(String... propertyKeysAndValues) { | |||
assertThat(propertyKeysAndValues.length % 2).describedAs("Number of parameters must be even").isEqualTo(0); | |||
assertThat(propertyKeysAndValues.length % 2).describedAs("Number of parameters must be even").isZero(); | |||
Properties properties = new Properties(); | |||
for (int i = 0; i < propertyKeysAndValues.length; i++) { | |||
properties.put(propertyKeysAndValues[i++], propertyKeysAndValues[i]); | |||
@@ -114,9 +114,9 @@ public class EsLoggingTest { | |||
private void verifyProperties(Properties properties, String... expectedPropertyKeysAndValuesOrdered) { | |||
if (expectedPropertyKeysAndValuesOrdered.length == 0) { | |||
assertThat(properties.size()).isEqualTo(0); | |||
assertThat(properties.size()).isZero(); | |||
} else { | |||
assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isEqualTo(0); | |||
assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isZero(); | |||
Set<String> keys = new HashSet<>(expectedPropertyKeysAndValuesOrdered.length / 2 + 1); | |||
keys.add("status"); | |||
for (int i = 0; i < expectedPropertyKeysAndValuesOrdered.length; i++) { |
@@ -268,7 +268,7 @@ public class FileUtils2Test { | |||
public void sizeOf_is_zero_on_empty_files() throws IOException { | |||
File file = temporaryFolder.newFile(); | |||
assertThat(FileUtils2.sizeOf(file.toPath())).isEqualTo(0); | |||
assertThat(FileUtils2.sizeOf(file.toPath())).isZero(); | |||
} | |||
@Test |
@@ -482,7 +482,7 @@ public class Log4JPropertiesBuilderTest { | |||
private static Log4JPropertiesBuilder newLog4JPropertiesBuilder(String... propertyKeysAndValues) { | |||
Properties properties = new Properties(); | |||
assertThat(propertyKeysAndValues.length % 2).describedAs("propertyKeysAndValues must have even length").isEqualTo(0); | |||
assertThat(propertyKeysAndValues.length % 2).describedAs("propertyKeysAndValues must have even length").isZero(); | |||
for (int i = 0; i < propertyKeysAndValues.length; i++) { | |||
properties.put(propertyKeysAndValues[i++], propertyKeysAndValues[i]); | |||
} | |||
@@ -534,7 +534,7 @@ public class Log4JPropertiesBuilderTest { | |||
if (expectedPropertyKeysAndValuesOrdered.length == 0) { | |||
assertThat(properties.size()).isEqualTo(1); | |||
} else { | |||
assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isEqualTo(0); | |||
assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isZero(); | |||
Set<String> keys = new HashSet<>(expectedPropertyKeysAndValuesOrdered.length / 2 + 1); | |||
keys.add("status"); | |||
for (int i = 0; i < expectedPropertyKeysAndValuesOrdered.length; i++) { |
@@ -70,7 +70,7 @@ public class LogLevelConfigTest { | |||
assertThat(underTest.getConfiguredByProperties()).hasSize(1); | |||
assertThat(underTest.getConfiguredByProperties().get(rootLoggerName)) | |||
.containsExactly("sonar.log.level", "sonar.log.level.es"); | |||
assertThat(underTest.getConfiguredByHardcodedLevel()).hasSize(0); | |||
assertThat(underTest.getConfiguredByHardcodedLevel()).isEmpty(); | |||
} | |||
@Test | |||
@@ -132,7 +132,7 @@ public class LogLevelConfigTest { | |||
assertThat(underTest.getConfiguredByProperties()).hasSize(1); | |||
assertThat(underTest.getConfiguredByProperties().get("foo")) | |||
.containsExactly("sonar.log.level", "sonar.log.level.web", "sonar.log.level.web.sql"); | |||
assertThat(underTest.getConfiguredByHardcodedLevel()).hasSize(0); | |||
assertThat(underTest.getConfiguredByHardcodedLevel()).isEmpty(); | |||
} | |||
@Test |
@@ -165,7 +165,7 @@ public class LogbackHelperTest { | |||
julLogger.severe("Message1"); | |||
// JUL bridge has not been initialized, nothing in logs | |||
assertThat(memoryAppender.getLogs()).hasSize(0); | |||
assertThat(memoryAppender.getLogs()).isEmpty(); | |||
// Enabling JUL bridge | |||
LoggerContextListener propagator = underTest.enableJulChangePropagation(ctx); |
@@ -228,7 +228,7 @@ public class ComponentIndexerTest { | |||
result = recover(); | |||
assertThat(result.getTotal()).isEqualTo(1L); | |||
assertThat(result.getFailures()).isEqualTo(1L); | |||
assertThat(es.countDocuments(TYPE_COMPONENT)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_COMPONENT)).isZero(); | |||
es.unlockWrites(TYPE_COMPONENT); | |||
@@ -31,13 +31,13 @@ public class BulkIndexerConcurrentRequestCalculationTest { | |||
@Test | |||
public void should_not_parallelize_if_regular_size() { | |||
assertConcurrentRequests(BulkIndexer.Size.REGULAR, cores(4)) | |||
.isEqualTo(0); | |||
.isZero(); | |||
} | |||
@Test | |||
public void should_not_parallelize_if_large_indexing_but_few_cores() { | |||
assertConcurrentRequests(BulkIndexer.Size.LARGE, cores(4)) | |||
.isEqualTo(0); | |||
.isZero(); | |||
} | |||
/** |
@@ -62,7 +62,7 @@ public class BulkIndexerTest { | |||
indexer.start(); | |||
indexer.stop(); | |||
assertThat(count()).isEqualTo(0); | |||
assertThat(count()).isZero(); | |||
} | |||
@Test | |||
@@ -73,7 +73,7 @@ public class BulkIndexerTest { | |||
indexer.add(newIndexRequest(78)); | |||
// request is not sent yet | |||
assertThat(count()).isEqualTo(0); | |||
assertThat(count()).isZero(); | |||
// send remaining requests | |||
indexer.stop(); | |||
@@ -89,7 +89,7 @@ public class BulkIndexerTest { | |||
indexer.start(); | |||
// replicas are temporarily disabled | |||
assertThat(replicas()).isEqualTo(0); | |||
assertThat(replicas()).isZero(); | |||
for (int i = 0; i < 10; i++) { | |||
indexer.add(newIndexRequest(i)); | |||
@@ -98,7 +98,7 @@ public class BulkIndexerTest { | |||
assertThat(result.isSuccess()).isTrue(); | |||
assertThat(result.getSuccess()).isEqualTo(10); | |||
assertThat(result.getFailures()).isEqualTo(0); | |||
assertThat(result.getFailures()).isZero(); | |||
assertThat(result.getTotal()).isEqualTo(10); | |||
assertThat(count()).isEqualTo(10); | |||
// replicas are re-enabled |
@@ -32,9 +32,9 @@ public class IndexingResultTest { | |||
@Test | |||
public void test_empty() { | |||
assertThat(underTest.getFailures()).isEqualTo(0); | |||
assertThat(underTest.getSuccess()).isEqualTo(0); | |||
assertThat(underTest.getTotal()).isEqualTo(0); | |||
assertThat(underTest.getFailures()).isZero(); | |||
assertThat(underTest.getSuccess()).isZero(); | |||
assertThat(underTest.getTotal()).isZero(); | |||
assertThat(underTest.getSuccessRatio()).isEqualTo(1.0, DOUBLE_OFFSET); | |||
assertThat(underTest.isSuccess()).isTrue(); | |||
} | |||
@@ -46,7 +46,7 @@ public class IndexingResultTest { | |||
underTest.incrementSuccess(); | |||
underTest.incrementSuccess(); | |||
assertThat(underTest.getFailures()).isEqualTo(0); | |||
assertThat(underTest.getFailures()).isZero(); | |||
assertThat(underTest.getSuccess()).isEqualTo(2); | |||
assertThat(underTest.getTotal()).isEqualTo(2); | |||
assertThat(underTest.getSuccessRatio()).isEqualTo(1.0, DOUBLE_OFFSET); | |||
@@ -59,7 +59,7 @@ public class IndexingResultTest { | |||
underTest.incrementRequests(); | |||
assertThat(underTest.getFailures()).isEqualTo(2); | |||
assertThat(underTest.getSuccess()).isEqualTo(0); | |||
assertThat(underTest.getSuccess()).isZero(); | |||
assertThat(underTest.getTotal()).isEqualTo(2); | |||
assertThat(underTest.getSuccessRatio()).isEqualTo(0.0, DOUBLE_OFFSET); | |||
assertThat(underTest.isSuccess()).isFalse(); | |||
@@ -82,9 +82,9 @@ public class IndexingResultTest { | |||
@Test | |||
public void correctness_even_with_no_data() { | |||
assertThat(underTest.getFailures()).isEqualTo(0); | |||
assertThat(underTest.getSuccess()).isEqualTo(0); | |||
assertThat(underTest.getTotal()).isEqualTo(0); | |||
assertThat(underTest.getFailures()).isZero(); | |||
assertThat(underTest.getSuccess()).isZero(); | |||
assertThat(underTest.getTotal()).isZero(); | |||
assertThat(underTest.getSuccessRatio()).isEqualTo(1.0); | |||
assertThat(underTest.isSuccess()).isTrue(); | |||
} |
@@ -41,7 +41,7 @@ public class SearchOptionsTest { | |||
assertThat(options.getFacets()).isEmpty(); | |||
assertThat(options.getFields()).isEmpty(); | |||
assertThat(options.getOffset()).isEqualTo(0); | |||
assertThat(options.getOffset()).isZero(); | |||
assertThat(options.getLimit()).isEqualTo(10); | |||
assertThat(options.getPage()).isEqualTo(1); | |||
} | |||
@@ -58,7 +58,7 @@ public class SearchOptionsTest { | |||
public void page_starts_at_one() { | |||
SearchOptions options = new SearchOptions().setPage(1, 10); | |||
assertThat(options.getLimit()).isEqualTo(10); | |||
assertThat(options.getOffset()).isEqualTo(0); | |||
assertThat(options.getOffset()).isZero(); | |||
assertThat(options.getPage()).isEqualTo(1); | |||
} | |||
@@ -159,7 +159,7 @@ public class NewIssuesStatisticsTest { | |||
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.COMPONENT); | |||
Stream.of(globalDistribution, assigneeDistribution) | |||
.forEach(distribution -> { | |||
assertThat(distribution.getTotal()).isEqualTo(0); | |||
assertThat(distribution.getTotal()).isZero(); | |||
assertThat(distribution.getForLabel(null).isPresent()).isFalse(); | |||
}); | |||
} | |||
@@ -204,7 +204,7 @@ public class NewIssuesStatisticsTest { | |||
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.RULE); | |||
Stream.of(globalDistribution, assigneeDistribution) | |||
.forEach(distribution -> { | |||
assertThat(distribution.getTotal()).isEqualTo(0); | |||
assertThat(distribution.getTotal()).isZero(); | |||
assertThat(distribution.getForLabel(null).isPresent()).isFalse(); | |||
}); | |||
} | |||
@@ -249,14 +249,14 @@ public class NewIssuesStatisticsTest { | |||
assignees.forEach(assignee -> { | |||
NewIssuesStatistics.Stats stats = underTest.getAssigneesStatistics().get(assignee); | |||
DistributedMetricStatsInt assigneeStats = stats.getDistributedMetricStats(Metric.ASSIGNEE); | |||
assertThat(assigneeStats.getOnCurrentAnalysis()).isEqualTo(0); | |||
assertThat(assigneeStats.getOnCurrentAnalysis()).isZero(); | |||
assertThat(assigneeStats.getTotal()).isEqualTo(1); | |||
assignees.forEach(s -> { | |||
Optional<MetricStatsInt> forLabelOpts = assigneeStats.getForLabel(s); | |||
if (s.equals(assignee)) { | |||
assertThat(forLabelOpts.isPresent()).isTrue(); | |||
MetricStatsInt forLabel = forLabelOpts.get(); | |||
assertThat(forLabel.getOnCurrentAnalysis()).isEqualTo(0); | |||
assertThat(forLabel.getOnCurrentAnalysis()).isZero(); | |||
assertThat(forLabel.getTotal()).isEqualTo(1); | |||
} else { | |||
assertThat(forLabelOpts.isPresent()).isFalse(); | |||
@@ -270,7 +270,7 @@ public class NewIssuesStatisticsTest { | |||
underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(null).setNew(new Random().nextBoolean())); | |||
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.ASSIGNEE); | |||
assertThat(globalDistribution.getTotal()).isEqualTo(0); | |||
assertThat(globalDistribution.getTotal()).isZero(); | |||
assertThat(globalDistribution.getForLabel(null).isPresent()).isFalse(); | |||
assertThat(underTest.getAssigneesStatistics()).isEmpty(); | |||
} | |||
@@ -308,7 +308,7 @@ public class NewIssuesStatisticsTest { | |||
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.TAG); | |||
Stream.of(globalDistribution, assigneeDistribution) | |||
.forEach(distribution -> { | |||
assertThat(distribution.getTotal()).isEqualTo(0); | |||
assertThat(distribution.getTotal()).isZero(); | |||
assertThat(distribution.getForLabel(null).isPresent()).isFalse(); | |||
}); | |||
} | |||
@@ -328,7 +328,7 @@ public class NewIssuesStatisticsTest { | |||
Stream.of(globalDistribution, assigneeDistribution) | |||
.forEach(distribution -> { | |||
assertThat(distribution.getOnCurrentAnalysis()).isEqualTo(expected); | |||
assertThat(distribution.getOffCurrentAnalysis()).isEqualTo(0); | |||
assertThat(distribution.getOffCurrentAnalysis()).isZero(); | |||
assertThat(distribution.getTotal()).isEqualTo(expected); | |||
}); | |||
} | |||
@@ -347,7 +347,7 @@ public class NewIssuesStatisticsTest { | |||
MetricStatsLong assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).effort(); | |||
Stream.of(globalDistribution, assigneeDistribution) | |||
.forEach(distribution -> { | |||
assertThat(distribution.getOnCurrentAnalysis()).isEqualTo(0); | |||
assertThat(distribution.getOnCurrentAnalysis()).isZero(); | |||
assertThat(distribution.getOffCurrentAnalysis()).isEqualTo(expected); | |||
assertThat(distribution.getTotal()).isEqualTo(expected); | |||
}); | |||
@@ -361,7 +361,7 @@ public class NewIssuesStatisticsTest { | |||
MetricStatsLong globalDistribution = underTest.globalStatistics().effort(); | |||
MetricStatsLong assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).effort(); | |||
Stream.of(globalDistribution, assigneeDistribution) | |||
.forEach(distribution -> assertThat(distribution.getTotal()).isEqualTo(0)); | |||
.forEach(distribution -> assertThat(distribution.getTotal()).isZero()); | |||
} | |||
@Test |
@@ -244,7 +244,7 @@ public class ProjectMeasuresIndexerTest { | |||
db.getDbClient().purgeDao().deleteProject(db.getSession(), project.uuid()); | |||
IndexingResult result = indexProject(project, PROJECT_DELETION); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero(); | |||
assertThat(result.getTotal()).isEqualTo(1L); | |||
assertThat(result.getSuccess()).isEqualTo(1L); | |||
} | |||
@@ -257,7 +257,7 @@ public class ProjectMeasuresIndexerTest { | |||
underTest.index(db.getSession(), emptyList()); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero(); | |||
} | |||
@Test | |||
@@ -273,7 +273,7 @@ public class ProjectMeasuresIndexerTest { | |||
result = recover(); | |||
assertThat(result.getTotal()).isEqualTo(1L); | |||
assertThat(result.getFailures()).isEqualTo(1L); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero(); | |||
assertThatEsQueueTableHasSize(1); | |||
es.unlockWrites(TYPE_PROJECT_MEASURES); | |||
@@ -292,7 +292,7 @@ public class ProjectMeasuresIndexerTest { | |||
underTest.indexOnAnalysis(branch.uuid()); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero(); | |||
} | |||
private IndexingResult indexProject(ComponentDto project, ProjectIndexer.Cause cause) { |
@@ -107,7 +107,7 @@ public class DefaultNotificationManagerTest { | |||
assertThat(underTest.getChannels()).containsOnly(emailChannel, twitterChannel); | |||
underTest = new DefaultNotificationManager(new NotificationChannel[] {}, dbClient); | |||
assertThat(underTest.getChannels()).hasSize(0); | |||
assertThat(underTest.getChannels()).isEmpty(); | |||
} | |||
@Test | |||
@@ -150,7 +150,7 @@ public class DefaultNotificationManagerTest { | |||
@Test | |||
public void shouldFindNoRecipient() { | |||
assertThat(underTest.findSubscribedRecipientsForDispatcher(dispatcher, "uuid_45", new SubscriberPermissionsOnProject(UserRole.USER)).asMap().entrySet()) | |||
.hasSize(0); | |||
.isEmpty(); | |||
} | |||
@Test |
@@ -66,12 +66,12 @@ public class ProcessInfoProviderTest { | |||
new TestSystemInfoSection("foo"), | |||
new TestSystemInfoSection("bar")}); | |||
assertThat(ProcessInfoProvider.provide().getSectionsCount()).isEqualTo(0); | |||
assertThat(ProcessInfoProvider.provide().getSectionsCount()).isZero(); | |||
underTest.start(); | |||
assertThat(ProcessInfoProvider.provide().getSectionsCount()).isEqualTo(2); | |||
underTest.stop(); | |||
assertThat(ProcessInfoProvider.provide().getSectionsCount()).isEqualTo(0); | |||
assertThat(ProcessInfoProvider.provide().getSectionsCount()).isZero(); | |||
} | |||
} |
@@ -119,7 +119,7 @@ public class ActiveRuleIndexerTest { | |||
underTest.commitAndIndex(db.getSession(), Collections.emptyList()); | |||
assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero(); | |||
assertThatEsQueueTableIsEmpty(); | |||
} | |||
@@ -144,7 +144,7 @@ public class ActiveRuleIndexerTest { | |||
db.getDbClient().activeRuleDao().delete(db.getSession(), ar.getKey()); | |||
commitAndIndex(rule1, ar); | |||
assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero(); | |||
assertThatEsQueueTableIsEmpty(); | |||
} | |||
@@ -156,7 +156,7 @@ public class ActiveRuleIndexerTest { | |||
underTest.index(db.getSession(), singletonList(item)); | |||
assertThatEsQueueTableIsEmpty(); | |||
assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0); | |||
assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero(); | |||
} | |||
@Test | |||
@@ -184,7 +184,7 @@ public class ActiveRuleIndexerTest { | |||
} | |||
private void assertThatEsQueueTableIsEmpty() { | |||
assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isZero(); | |||
} | |||
private void assertThatEsQueueContainsExactly(EsQueueDto expected) { |
@@ -324,7 +324,7 @@ public class RuleIndexTest { | |||
SearchOptions options = new SearchOptions().addFacets(FACET_TAGS); | |||
// do not fail | |||
assertThat(underTest.search(query, options).getTotal()).isEqualTo(0); | |||
assertThat(underTest.search(query, options).getTotal()).isZero(); | |||
} | |||
@Test |
@@ -98,7 +98,7 @@ public class SynchronousWebHooksImplTest { | |||
underTest.sendProjectAnalysisUpdate(new WebHooks.Analysis(componentDto.uuid(), "1", "#1"), () -> mock); | |||
assertThat(caller.countSent()).isEqualTo(0); | |||
assertThat(caller.countSent()).isZero(); | |||
assertThat(logTester.logs(DEBUG)).isEmpty(); | |||
verifyZeroInteractions(deliveryStorage); | |||
} | |||
@@ -109,7 +109,7 @@ public class SynchronousWebHooksImplTest { | |||
underTest.sendProjectAnalysisUpdate(new WebHooks.Analysis(componentDto.uuid(), "1", "#1"), () -> mock, taskStatistics); | |||
assertThat(caller.countSent()).isEqualTo(0); | |||
assertThat(caller.countSent()).isZero(); | |||
assertThat(logTester.logs(DEBUG)).isEmpty(); | |||
verifyZeroInteractions(deliveryStorage); | |||
verifyLogStatistics(0, 0); |
@@ -252,7 +252,7 @@ public class PluginDownloaderTest { | |||
@Test | |||
public void getDownloadedPluginFilenames_reads_plugin_info_of_files_in_download_folder() throws Exception { | |||
pluginDownloader.start(); | |||
assertThat(pluginDownloader.getDownloadedPlugins()).hasSize(0); | |||
assertThat(pluginDownloader.getDownloadedPlugins()).isEmpty(); | |||
File file1 = new File(downloadDir, "file1.jar"); | |||
file1.createNewFile(); |
@@ -167,7 +167,7 @@ public class JwtCsrfVerifierTest { | |||
verify(response).addCookie(cookieArgumentCaptor.capture()); | |||
Cookie cookie = cookieArgumentCaptor.getValue(); | |||
assertThat(cookie.getValue()).isNull(); | |||
assertThat(cookie.getMaxAge()).isEqualTo(0); | |||
assertThat(cookie.getMaxAge()).isZero(); | |||
} | |||
private void verifyCookie(Cookie cookie) { |
@@ -191,6 +191,6 @@ public class OAuth2AuthenticationParametersImplTest { | |||
assertThat(updatedCookie.getName()).isEqualTo(AUTHENTICATION_COOKIE_NAME); | |||
assertThat(updatedCookie.getValue()).isNull(); | |||
assertThat(updatedCookie.getPath()).isEqualTo("/"); | |||
assertThat(updatedCookie.getMaxAge()).isEqualTo(0); | |||
assertThat(updatedCookie.getMaxAge()).isZero(); | |||
} | |||
} |
@@ -83,7 +83,7 @@ public class OAuthCsrfVerifierTest { | |||
assertThat(updatedCookie.getName()).isEqualTo("OAUTHSTATE"); | |||
assertThat(updatedCookie.getValue()).isNull(); | |||
assertThat(updatedCookie.getPath()).isEqualTo("/"); | |||
assertThat(updatedCookie.getMaxAge()).isEqualTo(0); | |||
assertThat(updatedCookie.getMaxAge()).isZero(); | |||
} | |||
@Test | |||
@@ -99,7 +99,7 @@ public class OAuthCsrfVerifierTest { | |||
assertThat(updatedCookie.getName()).isEqualTo("OAUTHSTATE"); | |||
assertThat(updatedCookie.getValue()).isNull(); | |||
assertThat(updatedCookie.getPath()).isEqualTo("/"); | |||
assertThat(updatedCookie.getMaxAge()).isEqualTo(0); | |||
assertThat(updatedCookie.getMaxAge()).isZero(); | |||
} | |||
@Test |
@@ -77,7 +77,7 @@ public class CeHttpClientImplTest { | |||
setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE); | |||
Optional<ProtobufSystemInfo.SystemInfo> info = underTest.retrieveSystemInfo(); | |||
assertThat(info.get().getSectionsCount()).isEqualTo(0); | |||
assertThat(info.get().getSectionsCount()).isZero(); | |||
} | |||
@Test |
@@ -208,7 +208,7 @@ public class NotificationMediumTest { | |||
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L); | |||
service = new NotificationService(dbClient); | |||
assertThat(service.getDispatchers()).hasSize(0); | |||
assertThat(service.getDispatchers()).isEmpty(); | |||
} | |||
@Test |
@@ -452,7 +452,7 @@ public class RegisterRulesTest { | |||
assertThat(rule1.getDescription()).isEqualTo("Description"); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name2"), new SearchOptions()).getTotal()).isEqualTo(1); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isEqualTo(0); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isZero(); | |||
} | |||
@Test | |||
@@ -533,7 +533,7 @@ public class RegisterRulesTest { | |||
SearchIdResult<String> searchRule2 = ruleIndex.search(new RuleQuery().setQueryText("Name2"), new SearchOptions()); | |||
assertThat(searchRule2.getUuids()).containsOnly(rule2.getUuid()); | |||
assertThat(searchRule2.getTotal()).isEqualTo(1); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isEqualTo(0); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isZero(); | |||
} | |||
@Test | |||
@@ -575,7 +575,7 @@ public class RegisterRulesTest { | |||
SearchIdResult<String> searchRule2 = ruleIndex.search(new RuleQuery().setQueryText("Name2"), new SearchOptions()); | |||
assertThat(searchRule2.getUuids()).containsOnly(rule2.getUuid()); | |||
assertThat(searchRule2.getTotal()).isEqualTo(1); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isEqualTo(0); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isZero(); | |||
} | |||
@Test | |||
@@ -691,7 +691,7 @@ public class RegisterRulesTest { | |||
assertThat(rule1.getDescription()).isEqualTo("Desc2"); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Desc2"), new SearchOptions()).getTotal()).isEqualTo(1); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Desc1"), new SearchOptions()).getTotal()).isEqualTo(0); | |||
assertThat(ruleIndex.search(new RuleQuery().setQueryText("Desc1"), new SearchOptions()).getTotal()).isZero(); | |||
} | |||
@Test | |||
@@ -748,7 +748,7 @@ public class RegisterRulesTest { | |||
RuleDto rule = dbClient.ruleDao().selectOrFailByKey(db.getSession(), RULE_KEY1); | |||
assertThat(rule.getStatus()).isEqualTo(REMOVED); | |||
assertThat(ruleIndex.search(new RuleQuery().setKey(RULE_KEY1.toString()), new SearchOptions()).getTotal()).isEqualTo(0); | |||
assertThat(ruleIndex.search(new RuleQuery().setKey(RULE_KEY1.toString()), new SearchOptions()).getTotal()).isZero(); | |||
// Re-install rule | |||
system.setNow(DATE3.getTime()); | |||
@@ -899,7 +899,7 @@ public class RegisterRulesTest { | |||
assertThat(dbClient.ruleDao().selectAllDefinitions(db.getSession())).hasSize(1); | |||
deprecatedRuleKeys = dbClient.ruleDao().selectAllDeprecatedRuleKeys(db.getSession()); | |||
assertThat(deprecatedRuleKeys).hasSize(0); | |||
assertThat(deprecatedRuleKeys).isEmpty(); | |||
} | |||
@Test |
@@ -245,7 +245,7 @@ public class IndexCreatorTest { | |||
// keep existing metadata | |||
.doesNotContain("Create type metadatas/metadata"); | |||
// index has been dropped and re-created | |||
assertThat(es.countDocuments(FakeIndexDefinition.INDEX_TYPE)).isEqualTo(0); | |||
assertThat(es.countDocuments(FakeIndexDefinition.INDEX_TYPE)).isZero(); | |||
} | |||
private ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetadata>> mappings() { |
@@ -105,7 +105,7 @@ public class PermissionIndexerTest { | |||
underTest.index(db.getSession(), esQueueDtos); | |||
assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isZero(); | |||
assertThat(es.countDocuments(INDEX_TYPE_FOO_AUTH)).isEqualTo(1); | |||
} | |||
@@ -161,7 +161,7 @@ public class ActivityActionTest { | |||
.setParam("status", "FAILED,IN_PROGRESS,SUCCESS") | |||
.setParam(PARAM_MAX_EXECUTED_AT, "2016-02-15")); | |||
assertThat(activityResponse.getTasksCount()).isEqualTo(0); | |||
assertThat(activityResponse.getTasksCount()).isZero(); | |||
} | |||
@Test |
@@ -144,8 +144,8 @@ public class ActivityStatusActionTest { | |||
public void empty_status() { | |||
Ce.ActivityStatusWsResponse result = call(); | |||
assertThat(result.getPending()).isEqualTo(0); | |||
assertThat(result.getFailing()).isEqualTo(0); | |||
assertThat(result.getPending()).isZero(); | |||
assertThat(result.getFailing()).isZero(); | |||
} | |||
@Test |
@@ -82,7 +82,7 @@ public class ComponentActionTest { | |||
.setParam(PARAM_COMPONENT, project.getKey()) | |||
.executeProtobuf(Ce.ComponentResponse.class); | |||
assertThat(response.getQueueCount()).isEqualTo(0); | |||
assertThat(response.getQueueCount()).isZero(); | |||
assertThat(response.hasCurrent()).isFalse(); | |||
} | |||
@@ -167,7 +167,7 @@ public class ComponentActionTest { | |||
Ce.ComponentResponse response = ws.newRequest() | |||
.setParam(PARAM_COMPONENT, project.getKey()) | |||
.executeProtobuf(Ce.ComponentResponse.class); | |||
assertThat(response.getQueueCount()).isEqualTo(0); | |||
assertThat(response.getQueueCount()).isZero(); | |||
// T3 is the latest task executed on PROJECT_1 ignoring Canceled ones | |||
assertThat(response.hasCurrent()).isTrue(); | |||
Ce.Task current = response.getCurrent(); |
@@ -321,11 +321,11 @@ public class SearchProjectsActionTest { | |||
SearchProjectsWsResponse result = call(request); | |||
assertThat(result.getComponentsCount()).isEqualTo(0); | |||
assertThat(result.getComponentsCount()).isZero(); | |||
Common.Paging paging = result.getPaging(); | |||
assertThat(paging.getPageIndex()).isEqualTo(1); | |||
assertThat(paging.getPageSize()).isEqualTo(100); | |||
assertThat(paging.getTotal()).isEqualTo(0); | |||
assertThat(paging.getTotal()).isZero(); | |||
} | |||
@Test |
@@ -308,7 +308,7 @@ public class TreeActionTest { | |||
assertThat(response.getBaseComponent().getKey()).isEqualTo(project.getDbKey()); | |||
assertThat(response.getComponentsList()).isEmpty(); | |||
assertThat(response.getPaging().getTotal()).isEqualTo(0); | |||
assertThat(response.getPaging().getTotal()).isZero(); | |||
assertThat(response.getPaging().getPageSize()).isEqualTo(100); | |||
assertThat(response.getPaging().getPageIndex()).isEqualTo(1); | |||
} |
@@ -98,7 +98,7 @@ public class SearchActionTest { | |||
public void empty_list() { | |||
SearchResponse result = call(); | |||
assertThat(result.getFavoritesCount()).isEqualTo(0); | |||
assertThat(result.getFavoritesCount()).isZero(); | |||
assertThat(result.getFavoritesList()).isEmpty(); | |||
} | |||
@@ -164,7 +164,7 @@ public class WebIssueStorageTest { | |||
underTest.save(db.getSession(), singletonList(issue)); | |||
assertThat(db.countRowsOfTable("issues")).isEqualTo(1); | |||
assertThat(db.countRowsOfTable("issue_changes")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable("issue_changes")).isZero(); | |||
DefaultIssue updated = new DefaultIssue() | |||
.setKey(issue.key()) |
@@ -250,7 +250,7 @@ public class LiveMeasureComputerImplTest { | |||
public void do_nothing_if_project_has_not_been_analyzed() { | |||
// project has no snapshots | |||
List<QGChangeEvent> result = run(file1, newIncrementalFormula()); | |||
assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isZero(); | |||
assertThatProjectNotChanged(result, project); | |||
} | |||
@@ -258,7 +258,7 @@ public class LiveMeasureComputerImplTest { | |||
public void do_nothing_if_input_components_are_empty() { | |||
List<QGChangeEvent> result = run(emptyList(), newIncrementalFormula()); | |||
assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isZero(); | |||
assertThatProjectNotChanged(result, project); | |||
} | |||
@@ -507,6 +507,6 @@ public class LiveMeasureComputerImplTest { | |||
private void assertThatProjectNotChanged(List<QGChangeEvent> events, ComponentDto project) { | |||
assertThat(projectIndexer.hasBeenCalled(project.uuid(), ProjectIndexer.Cause.MEASURE_CHANGE)).isFalse(); | |||
assertThat(events).hasSize(0); | |||
assertThat(events).isEmpty(); | |||
} | |||
} |
@@ -98,7 +98,7 @@ public class ComponentActionTest { | |||
assertThat(response.getMetrics().getMetricsCount()).isEqualTo(1); | |||
assertThat(response.hasPeriod()).isFalse(); | |||
assertThat(response.getPeriods().getPeriodsCount()).isEqualTo(0); | |||
assertThat(response.getPeriods().getPeriodsCount()).isZero(); | |||
assertThat(response.getComponent().getKey()).isEqualTo(project.getDbKey()); | |||
} | |||
@@ -524,7 +524,7 @@ public class ComponentTreeActionTest { | |||
.executeProtobuf(ComponentTreeWsResponse.class); | |||
assertThat(result.getBaseComponent().getKey()).isEqualTo(project.getKey()); | |||
assertThat(result.getComponentsCount()).isEqualTo(0); | |||
assertThat(result.getComponentsCount()).isZero(); | |||
} | |||
@Test |
@@ -269,7 +269,7 @@ public class SearchActionTest { | |||
userSession.setNonRoot(); | |||
SearchWsResponse result = call(singletonList(project1.getDbKey()), singletonList(metric.getKey())); | |||
assertThat(result.getMeasuresCount()).isEqualTo(0); | |||
assertThat(result.getMeasuresCount()).isZero(); | |||
userSession.setRoot(); | |||
result = call(singletonList(project1.getDbKey()), singletonList(metric.getKey())); |
@@ -119,7 +119,7 @@ public class SearchHistoryActionTest { | |||
SearchHistoryResponse result = call(request); | |||
assertThat(result.getMeasuresList()).hasSize(1); | |||
assertThat(result.getMeasures(0).getHistoryCount()).isEqualTo(0); | |||
assertThat(result.getMeasures(0).getHistoryCount()).isZero(); | |||
assertThat(result.getPaging()).extracting(Paging::getPageIndex, Paging::getPageSize, Paging::getTotal) | |||
// pagination is applied to the number of analyses |
@@ -88,7 +88,7 @@ public class CreateActionTest { | |||
assertThat(metric.getDomain()).isNull(); | |||
assertThat(metric.isUserManaged()).isTrue(); | |||
assertThat(metric.isEnabled()).isTrue(); | |||
assertThat(metric.getDirection()).isEqualTo(0); | |||
assertThat(metric.getDirection()).isZero(); | |||
assertThat(metric.isQualitative()).isFalse(); | |||
} | |||
@@ -218,7 +218,7 @@ public class UnsetActionTest { | |||
} | |||
private void assertTableEmpty() { | |||
assertThat(db.countRowsOfTable(dbSession, "new_code_periods")).isEqualTo(0); | |||
assertThat(db.countRowsOfTable(dbSession, "new_code_periods")).isZero(); | |||
} | |||
private void assertTableContainsOnly(@Nullable String projectUuid, @Nullable String branchUuid, NewCodePeriodType type, @Nullable String value) { |
@@ -67,10 +67,10 @@ public class NotificationCenterTest { | |||
assertThat(underTest.getChannels()).hasSize(1); | |||
underTest = new NotificationCenter(); | |||
assertThat(underTest.getChannels()).hasSize(0); | |||
assertThat(underTest.getChannels()).isEmpty(); | |||
underTest = new NotificationCenter(new NotificationDispatcherMetadata[] {NotificationDispatcherMetadata.create("Dispatcher1").setProperty("global", "true")}); | |||
assertThat(underTest.getChannels()).hasSize(0); | |||
assertThat(underTest.getChannels()).isEmpty(); | |||
assertThat(underTest.getDispatcherKeysForProperty("global", null)).hasSize(1); | |||
} | |||
@@ -217,7 +217,7 @@ public class OrganizationDeleterTest { | |||
assertThat(db.getDbClient().organizationMemberDao().select(db.getSession(), org.getUuid(), user1.getUuid())).isNotPresent(); | |||
assertThat(db.getDbClient().organizationMemberDao().select(db.getSession(), org.getUuid(), user2.getUuid())).isNotPresent(); | |||
assertThat(db.getDbClient().organizationMemberDao().select(db.getSession(), otherOrg.getUuid(), user1.getUuid())).isPresent(); | |||
assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(org.getUuid()).build(), new SearchOptions()).getTotal()).isEqualTo(0); | |||
assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(org.getUuid()).build(), new SearchOptions()).getTotal()).isZero(); | |||
assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(otherOrg.getUuid()).build(), new SearchOptions()).getTotal()).isEqualTo(1); | |||
verify(projectLifeCycleListeners).onProjectsDeleted(emptySet()); | |||
} |