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();
}
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);
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
@Test
public void two_empty_lists_are_not_considered_as_equal() {
- assertThat(underTest.score(emptyList(), emptyList())).isEqualTo(0);
+ assertThat(underTest.score(emptyList(), emptyList())).isZero();
}
}
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) {
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) {
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();
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);
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);
underTest.visitAny(FILE);
List<DefaultIssue> issues = newArrayList(protoIssueCache.traverse());
- assertThat(issues).hasSize(0);
+ assertThat(issues).isEmpty();
}
@Test
Input<DefaultIssue> input = underTest.create(component);
assertThat(input.getIssues()).isEmpty();
- assertThat(input.getLineHashSequence().length()).isEqualTo(0);
+ assertThat(input.getLineHashSequence().length()).isZero();
}
}
ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
verify(check).onCheck(contextArgumentCaptor.capture());
- assertThat(contextArgumentCaptor.getValue().getNcloc()).isEqualTo(0);
+ assertThat(contextArgumentCaptor.getValue().getNcloc()).isZero();
}
@Test
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();
}
assertThat(computeCoverageLine.read(lineBuilder)).isEmpty();
assertThat(lineBuilder.hasLineHits()).isTrue();
- assertThat(lineBuilder.getLineHits()).isEqualTo(0);
+ assertThat(lineBuilder.getLineHits()).isZero();
}
@Test
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");
underTest.execute(new TestComputationStepContext());
- assertThat(dbTester.countRowsOfTable("analysis_properties")).isEqualTo(0);
+ assertThat(dbTester.countRowsOfTable("analysis_properties")).isZero();
}
@Test
underTest.execute(new TestComputationStepContext());
- assertThat(dbTester.countRowsOfTable("analysis_properties")).isEqualTo(0);
+ assertThat(dbTester.countRowsOfTable("analysis_properties")).isZero();
}
@Test
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);
}
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);
}
}
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) {
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);
}
});
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
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);
}
@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
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
}
assertThat(getUnderTest().getInProgressCount()).isEqualTo(calls);
- assertThat(getUnderTest().getProcessingTime()).isEqualTo(0);
+ assertThat(getUnderTest().getProcessingTime()).isZero();
}
@Test
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);
}
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);
}
@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);
}
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);
}
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);
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));
int total = underTest.countByQuery(db.getSession(), query);
assertThat(result).isEmpty();
- assertThat(total).isEqualTo(0);
+ assertThat(total).isZero();
}
@Test
int total = underTest.countByQuery(db.getSession(), query);
assertThat(result).isEmpty();
- assertThat(total).isEqualTo(0);
+ assertThat(total).isZero();
}
@Test
int total = underTest.countByQuery(db.getSession(), query);
assertThat(result).isEmpty();
- assertThat(total).isEqualTo(0);
+ assertThat(total).isZero();
}
@Test
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
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) {
@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));
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
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);
}
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
int count = underTest.countByQuery(dbSession, dbQuery);
assertThat(result).isEmpty();
- assertThat(count).isEqualTo(0);
+ assertThat(count).isZero();
}
@Test
int count = underTest.countByQuery(dbSession, dbQuery);
assertThat(result).isEmpty();
- assertThat(count).isEqualTo(0);
+ assertThat(count).isZero();
}
@Test
underTest.delete(db.getSession(), link.getUuid());
db.getSession().commit();
- assertThat(db.countRowsOfTable("project_links")).isEqualTo(0);
+ assertThat(db.countRowsOfTable("project_links")).isZero();
}
}
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
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
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());
underTest.delete(dbTester.getSession(), "E1");
dbTester.commit();
- assertThat(dbTester.countRowsOfTable("events")).isEqualTo(0);
+ assertThat(dbTester.countRowsOfTable("events")).isZero();
}
}
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);
}
dto.setSelectedAt(1400000000000L);
int count = underTest.updateIfBeforeSelectedDate(dto);
- assertThat(count).isEqualTo(0);
+ assertThat(count).isZero();
dbTester.getSession().commit();
// No change
// update
int count = underTest.upsert(db.getSession(), dto);
- assertThat(count).isEqualTo(0);
+ assertThat(count).isZero();
verifyPersisted(dto);
verifyTableSize(1);
}
// update
int count = underTest.upsert(db.getSession(), dto);
- assertThat(count).isEqualTo(0);
+ assertThat(count).isZero();
verifyPersisted(dto);
verifyTableSize(1);
}
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));
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);
}
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);
}
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
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
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()))
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()))
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");
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");
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() {
}
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();
}
}
PermissionQuery query = PermissionQuery.builder()
.build();
- assertThat(query.getPageOffset()).isEqualTo(0);
+ assertThat(query.getPageOffset()).isZero();
assertThat(query.getPageSize()).isEqualTo(20);
}
// 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);
}
int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, "124", SCAN.getKey());
- assertThat(deletedCount).isEqualTo(0);
+ assertThat(deletedCount).isZero();
assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey());
}
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());
}
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());
}
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) {
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) {
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();
}
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);
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
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();
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();
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();
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();
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();
underTest.deleteParam(dbSession, param);
- assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, activeRule.getUuid())).hasSize(0);
+ assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, activeRule.getUuid())).isEmpty();
}
@Test
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);
}
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);
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);
}
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();
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();
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) {
FileSourceDto res = underTest.selectByFileUuid(dbSession, fileSourceDto.getFileUuid());
- assertThat(res.getLineCount()).isEqualTo(0);
+ assertThat(res.getLineCount()).isZero();
assertThat(res.getLineHashes()).isEmpty();
}
underTest.deleteByUuid(dbSession, aGroup.getUuid());
- assertThat(db.countRowsOfTable(dbSession, "groups")).isEqualTo(0);
+ assertThat(db.countRowsOfTable(dbSession, "groups")).isZero();
}
}
@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
underTest.insert(session, newUserDto());
session.commit();
- assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0);
+ assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero();
}
@Test
insertInactiveRootUser(newUserDto());
session.commit();
- assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0);
+ assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero();
}
@Test
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
@Test
public void migration_container_lazily_instance_components() {
- assertThat(StartCallCounter.startCalls).isEqualTo(0);
+ assertThat(StartCallCounter.startCalls).isZero();
StartCallCounter startCallCounter = underTest.getComponentByType(StartCallCounter.class);
}
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);
}
}
underTest.setBatchSize(0);
- assertThat(underTest.getMaxBatchSize()).isEqualTo(0);
+ assertThat(underTest.getMaxBatchSize()).isZero();
}
@Test
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
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
}
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);
}
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()
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"))
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"))
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) {
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
}
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]);
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++) {
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
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]);
}
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++) {
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
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
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);
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);
@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();
}
/**
indexer.start();
indexer.stop();
- assertThat(count()).isEqualTo(0);
+ assertThat(count()).isZero();
}
@Test
indexer.add(newIndexRequest(78));
// request is not sent yet
- assertThat(count()).isEqualTo(0);
+ assertThat(count()).isZero();
// send remaining requests
indexer.stop();
indexer.start();
// replicas are temporarily disabled
- assertThat(replicas()).isEqualTo(0);
+ assertThat(replicas()).isZero();
for (int i = 0; i < 10; i++) {
indexer.add(newIndexRequest(i));
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
@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();
}
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);
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();
@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();
}
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);
}
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);
}
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();
});
}
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();
});
}
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();
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();
}
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();
});
}
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);
});
}
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);
});
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
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);
}
underTest.index(db.getSession(), emptyList());
- assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0);
+ assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero();
}
@Test
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);
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) {
assertThat(underTest.getChannels()).containsOnly(emailChannel, twitterChannel);
underTest = new DefaultNotificationManager(new NotificationChannel[] {}, dbClient);
- assertThat(underTest.getChannels()).hasSize(0);
+ assertThat(underTest.getChannels()).isEmpty();
}
@Test
@Test
public void shouldFindNoRecipient() {
assertThat(underTest.findSubscribedRecipientsForDispatcher(dispatcher, "uuid_45", new SubscriberPermissionsOnProject(UserRole.USER)).asMap().entrySet())
- .hasSize(0);
+ .isEmpty();
}
@Test
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();
}
}
underTest.commitAndIndex(db.getSession(), Collections.emptyList());
- assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0);
+ assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero();
assertThatEsQueueTableIsEmpty();
}
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();
}
underTest.index(db.getSession(), singletonList(item));
assertThatEsQueueTableIsEmpty();
- assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0);
+ assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero();
}
@Test
}
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) {
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
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);
}
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);
@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();
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) {
assertThat(updatedCookie.getName()).isEqualTo(AUTHENTICATION_COOKIE_NAME);
assertThat(updatedCookie.getValue()).isNull();
assertThat(updatedCookie.getPath()).isEqualTo("/");
- assertThat(updatedCookie.getMaxAge()).isEqualTo(0);
+ assertThat(updatedCookie.getMaxAge()).isZero();
}
}
assertThat(updatedCookie.getName()).isEqualTo("OAUTHSTATE");
assertThat(updatedCookie.getValue()).isNull();
assertThat(updatedCookie.getPath()).isEqualTo("/");
- assertThat(updatedCookie.getMaxAge()).isEqualTo(0);
+ assertThat(updatedCookie.getMaxAge()).isZero();
}
@Test
assertThat(updatedCookie.getName()).isEqualTo("OAUTHSTATE");
assertThat(updatedCookie.getValue()).isNull();
assertThat(updatedCookie.getPath()).isEqualTo("/");
- assertThat(updatedCookie.getMaxAge()).isEqualTo(0);
+ assertThat(updatedCookie.getMaxAge()).isZero();
}
@Test
setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE);
Optional<ProtobufSystemInfo.SystemInfo> info = underTest.retrieveSystemInfo();
- assertThat(info.get().getSectionsCount()).isEqualTo(0);
+ assertThat(info.get().getSectionsCount()).isZero();
}
@Test
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
service = new NotificationService(dbClient);
- assertThat(service.getDispatchers()).hasSize(0);
+ assertThat(service.getDispatchers()).isEmpty();
}
@Test
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
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
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
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
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());
assertThat(dbClient.ruleDao().selectAllDefinitions(db.getSession())).hasSize(1);
deprecatedRuleKeys = dbClient.ruleDao().selectAllDeprecatedRuleKeys(db.getSession());
- assertThat(deprecatedRuleKeys).hasSize(0);
+ assertThat(deprecatedRuleKeys).isEmpty();
}
@Test
// 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() {
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);
}
.setParam("status", "FAILED,IN_PROGRESS,SUCCESS")
.setParam(PARAM_MAX_EXECUTED_AT, "2016-02-15"));
- assertThat(activityResponse.getTasksCount()).isEqualTo(0);
+ assertThat(activityResponse.getTasksCount()).isZero();
}
@Test
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
.setParam(PARAM_COMPONENT, project.getKey())
.executeProtobuf(Ce.ComponentResponse.class);
- assertThat(response.getQueueCount()).isEqualTo(0);
+ assertThat(response.getQueueCount()).isZero();
assertThat(response.hasCurrent()).isFalse();
}
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();
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
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);
}
public void empty_list() {
SearchResponse result = call();
- assertThat(result.getFavoritesCount()).isEqualTo(0);
+ assertThat(result.getFavoritesCount()).isZero();
assertThat(result.getFavoritesList()).isEmpty();
}
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())
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);
}
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);
}
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();
}
}
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());
}
.executeProtobuf(ComponentTreeWsResponse.class);
assertThat(result.getBaseComponent().getKey()).isEqualTo(project.getKey());
- assertThat(result.getComponentsCount()).isEqualTo(0);
+ assertThat(result.getComponentsCount()).isZero();
}
@Test
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()));
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
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();
}
}
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) {
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);
}
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());
}
if (permission.getKey().equals(SCAN_EXECUTION)) {
assertThat(permission.getUsersCount()).isEqualTo(1);
} else {
- assertThat(permission.getUsersCount()).isEqualTo(0);
+ assertThat(permission.getUsersCount()).isZero();
}
}
}
assertThat(result.hasPaging()).isTrue();
assertThat(result.getPaging()).extracting(Paging::getPageIndex, Paging::getPageSize, Paging::getTotal).containsExactly(1, 100, 0);
- assertThat(result.getAnalysesCount()).isEqualTo(0);
+ assertThat(result.getAnalysesCount()).isZero();
}
@Test
.executeProtobuf(ProjectStatusResponse.class);
assertThat(result.getProjectStatus().getStatus()).isEqualTo(Status.NONE);
- assertThat(result.getProjectStatus().getConditionsCount()).isEqualTo(0);
+ assertThat(result.getProjectStatus().getConditionsCount()).isZero();
}
@Test
.executeProtobuf(ProjectStatusResponse.class);
assertThat(result.getProjectStatus().getStatus()).isEqualTo(Status.NONE);
- assertThat(result.getProjectStatus().getConditionsCount()).isEqualTo(0);
+ assertThat(result.getProjectStatus().getConditionsCount()).isZero();
}
@Test
List<ActiveRuleChange> changes = deactivate(profile, rule);
verifyNoActiveRules();
- assertThat(changes).hasSize(0);
+ assertThat(changes).isEmpty();
}
@Test
List<ActiveRuleChange> changes = activate(childProfile, overrideActivation);
assertThatRuleIsUpdated(childProfile, rule, MAJOR, INHERITED, of(param.getName(), "foo"));
- assertThat(changes).hasSize(0);
+ assertThat(changes).isEmpty();
}
@Test
RuleActivation resetActivation = RuleActivation.createReset(rule.getUuid());
List<ActiveRuleChange> changes = activate(parentProfile, resetActivation);
verifyNoActiveRules();
- assertThat(changes).hasSize(0);
+ assertThat(changes).isEmpty();
}
@Test
BulkChangeResult bulkChangeResult = underTest.bulkActivateAndCommit(db.getSession(), profile, ruleQuery, MINOR);
- assertThat(bulkChangeResult.countFailed()).isEqualTo(0);
+ assertThat(bulkChangeResult.countFailed()).isZero();
assertThat(bulkChangeResult.countSucceeded()).isEqualTo(bulkSize);
assertThat(bulkChangeResult.getChanges()).hasSize(bulkSize);
assertThat(db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)).hasSize(bulkSize);
BulkChangeResult bulkChangeResult = underTest.bulkActivateAndCommit(db.getSession(), profile, ruleQuery, MINOR);
- assertThat(bulkChangeResult.countFailed()).isEqualTo(0);
+ assertThat(bulkChangeResult.countFailed()).isZero();
assertThat(bulkChangeResult.countSucceeded()).isEqualTo(bulkSize);
assertThat(bulkChangeResult.getChanges()).hasSize(bulkSize);
assertThat(db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)).hasSize(bulkSize);
// Now deactivate all rules
bulkChangeResult = underTest.bulkDeactivateAndCommit(db.getSession(), profile, ruleQuery);
- assertThat(bulkChangeResult.countFailed()).isEqualTo(0);
+ assertThat(bulkChangeResult.countFailed()).isZero();
assertThat(bulkChangeResult.countSucceeded()).isEqualTo(bulkSize);
assertThat(bulkChangeResult.getChanges()).hasSize(bulkSize);
- assertThat(db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)).hasSize(0);
+ assertThat(db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)).isEmpty();
rules.stream().forEach(
r -> assertThatRuleIsNotPresent(profile, r.getDefinition()));
}
BulkChangeResult bulkChangeResult = underTest.bulkDeactivateAndCommit(db.getSession(), childProfile, ruleQuery);
assertThat(bulkChangeResult.countFailed()).isEqualTo(1);
- assertThat(bulkChangeResult.countSucceeded()).isEqualTo(0);
- assertThat(bulkChangeResult.getChanges()).hasSize(0);
+ assertThat(bulkChangeResult.countSucceeded()).isZero();
+ assertThat(bulkChangeResult.getChanges()).isEmpty();
assertThatRuleIsActivated(parentProfile, rule, null, rule.getSeverityString(), null, emptyMap());
assertThatRuleIsActivated(childProfile, rule, null, rule.getSeverityString(), INHERITED, emptyMap());
}
assertThat(result.getChanges()).hasSize(3);
assertThat(result.countSucceeded()).isEqualTo(1);
- assertThat(result.countFailed()).isEqualTo(0);
+ assertThat(result.countFailed()).isZero();
// Rule1 must be activated with BLOCKER on all profiles
assertThatRuleIsActivated(parentProfile, rule1, null, BLOCKER, null, emptyMap());
}
private void verifyNoActiveRules() {
- assertThat(db.countRowsOfTable(db.getSession(), "active_rules")).isEqualTo(0);
+ assertThat(db.countRowsOfTable(db.getSession(), "active_rules")).isZero();
}
private RuleDefinitionDto createRule() {
dbSession.clearCache();
// 2. Assert ActiveRule in DAO
- assertThat(dbClient.activeRuleDao().selectByProfileUuid(dbSession, profile.getKee())).hasSize(0);
+ assertThat(dbClient.activeRuleDao().selectByProfileUuid(dbSession, profile.getKee())).isEmpty();
assertThat(dbClient.activeRuleDao().selectByProfileUuid(dbSession, php.getKee())).hasSize(2);
}
dbSession.clearCache();
// 2. Assert ActiveRule in DAO
- assertThat(dbClient.activeRuleDao().selectByProfileUuid(dbSession, profile.getKee())).hasSize(0);
+ assertThat(dbClient.activeRuleDao().selectByProfileUuid(dbSession, profile.getKee())).isEmpty();
// 1. Activate Rule with query returning 1 hits
wsActivateRules.newRequest().setMethod("POST")
assertThat(response.getTotal()).isEqualTo(0L);
assertThat(response.getP()).isEqualTo(1);
- assertThat(response.getRulesCount()).isEqualTo(0);
+ assertThat(response.getRulesCount()).isZero();
}
@Test
assertThat(definition.isInternal()).isTrue();
assertThat(definition.since()).isEqualTo("6.1");
assertThat(definition.responseExampleAsString()).isNotEmpty();
- assertThat(definition.params()).hasSize(0);
+ assertThat(definition.params()).isEmpty();
}
@Test
assertThat(definition.isPost()).isFalse();
assertThat(definition.isInternal()).isTrue();
assertThat(definition.responseExampleAsString()).isNotEmpty();
- assertThat(definition.params()).hasSize(0);
+ assertThat(definition.params()).isEmpty();
}
@Test
assertThat(reloaded).isEmpty();
int deliveriesCount = deliveryDao.countDeliveriesByWebhookUuid(dbSession, dto.getUuid());
- assertThat(deliveriesCount).isEqualTo(0);
+ assertThat(deliveriesCount).isZero();
}
assertThat(reloaded).isEmpty();
int deliveriesCount = deliveryDao.countDeliveriesByWebhookUuid(dbSession, dto.getUuid());
- assertThat(deliveriesCount).isEqualTo(0);
+ assertThat(deliveriesCount).isZero();
}
@Test
.setParam("componentKey", project.getDbKey())
.executeProtobuf(Webhooks.DeliveriesWsResponse.class);
- assertThat(response.getDeliveriesCount()).isEqualTo(0);
+ assertThat(response.getDeliveriesCount()).isZero();
}
@Test
.setParam("ceTaskId", "t1")
.executeProtobuf(Webhooks.DeliveriesWsResponse.class);
- assertThat(response.getDeliveriesCount()).isEqualTo(0);
+ assertThat(response.getDeliveriesCount()).isZero();
}
@Test
.setParam("webhook", "t1")
.executeProtobuf(Webhooks.DeliveriesWsResponse.class);
- assertThat(response.getDeliveriesCount()).isEqualTo(0);
+ assertThat(response.getDeliveriesCount()).isZero();
}
@Test
issue.addChange(null);
- assertThat(issue.changes()).hasSize(0);
+ assertThat(issue.changes()).isEmpty();
}
}
assertThat(diff.newValue()).isEqualTo("FIXED");
diff = diffs.diffs().get("donut");
- assertThat(diff.oldValue()).isEqualTo(null);
+ assertThat(diff.oldValue()).isNull();
assertThat(diff.newValue()).isEqualTo("new");
diff = diffs.diffs().get("gambas");
- assertThat(diff.oldValue()).isEqualTo(null);
+ assertThat(diff.oldValue()).isNull();
assertThat(diff.newValue()).isEqualTo("miam");
diff = diffs.diffs().get("acme");
assertThat(diff.oldValue()).isEqualTo("old");
- assertThat(diff.newValue()).isEqualTo(null);
+ assertThat(diff.newValue()).isNull();
}
@Test
assertThat(diffs.diffs()).hasSize(2);
FieldDiffs.Diff diff = diffs.diffs().get("severity");
- assertThat(diff.oldValue()).isEqualTo(null);
+ assertThat(diff.oldValue()).isNull();
assertThat(diff.newValue()).isEqualTo("INFO");
diff = diffs.diffs().get("resolution");
- assertThat(diff.oldValue()).isEqualTo(null);
- assertThat(diff.newValue()).isEqualTo(null);
+ assertThat(diff.oldValue()).isNull();
+ assertThat(diff.newValue()).isNull();
}
@Test
assertThat(compute(seq("abcde"), seq("abcde"), 4, 4)).isEqualTo(5);
assertThat(compute(seq("abcde"), seq("abcd"), 4, 4)).isEqualTo(4);
- assertThat(compute(seq("bcde"), seq("abcde"), 4, 4)).isEqualTo(0);
+ assertThat(compute(seq("bcde"), seq("abcde"), 4, 4)).isZero();
assertThat(compute(seq("bcde"), seq("abcde"), 3, 4)).isEqualTo(4);
}
Issue raw2 = rawInput.createIssue(RULE_MISSING_PACKAGE_INFO, "[com.test:abc] Missing package-info.java in package.");
Tracking<Issue, Issue> tracking = tracker.trackNonClosed(rawInput, baseInput);
- assertThat(tracking.getUnmatchedBases()).hasSize(0);
+ assertThat(tracking.getUnmatchedBases()).isEmpty();
assertThat(tracking.baseFor(raw1)).isEqualTo(base2);
assertThat(tracking.baseFor(raw2)).isEqualTo(base1);
}
@Test
public void stop_methods_returns_0() {
underTest.start();
- assertThat(underTest.stopInfo()).isEqualTo(0);
- assertThat(underTest.stopInfo("msg")).isEqualTo(0);
- assertThat(underTest.stopDebug()).isEqualTo(0);
- assertThat(underTest.stopDebug("msg")).isEqualTo(0);
- assertThat(underTest.stopTrace()).isEqualTo(0);
- assertThat(underTest.stopTrace("msg")).isEqualTo(0);
- assertThat(underTest.stopError("msg")).isEqualTo(0);
+ assertThat(underTest.stopInfo()).isZero();
+ assertThat(underTest.stopInfo("msg")).isZero();
+ assertThat(underTest.stopDebug()).isZero();
+ assertThat(underTest.stopDebug("msg")).isZero();
+ assertThat(underTest.stopTrace()).isZero();
+ assertThat(underTest.stopTrace("msg")).isZero();
+ assertThat(underTest.stopError("msg")).isZero();
}
}
@Test
public void index_empty_stream_returns_empty_map() {
- assertThat(Collections.<MyObj>emptyList().stream().collect(index(MyObj::getId)).size()).isEqualTo(0);
- assertThat(Collections.<MyObj>emptyList().stream().collect(index(MyObj::getId, MyObj::getText)).size()).isEqualTo(0);
+ assertThat(Collections.<MyObj>emptyList().stream().collect(index(MyObj::getId)).size()).isZero();
+ assertThat(Collections.<MyObj>emptyList().stream().collect(index(MyObj::getId, MyObj::getText)).size()).isZero();
}
@Test
@Test
public void unorderedIndex_empty_stream_returns_empty_map() {
- assertThat(Collections.<MyObj>emptyList().stream().collect(unorderedIndex(MyObj::getId)).size()).isEqualTo(0);
- assertThat(Collections.<MyObj>emptyList().stream().collect(unorderedIndex(MyObj::getId, MyObj::getText)).size()).isEqualTo(0);
+ assertThat(Collections.<MyObj>emptyList().stream().collect(unorderedIndex(MyObj::getId)).size()).isZero();
+ assertThat(Collections.<MyObj>emptyList().stream().collect(unorderedIndex(MyObj::getId, MyObj::getText)).size()).isZero();
}
@Test
public void unorderedFlattenIndex_empty_stream_returns_empty_map() {
assertThat(Collections.<MyObj2>emptyList().stream()
.collect(unorderedFlattenIndex(MyObj2::getId, MyObj2::getTexts))
- .size()).isEqualTo(0);
+ .size()).isZero();
}
@Test
Metadata metadata = new Metadata(2, 2, "", new int[] {0, 10}, new int[] {9, 15}, 16);
DefaultInputFile file = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), f -> f.setMetadata(metadata));
assertThat(file.newPointer(1, 0).line()).isEqualTo(1);
- assertThat(file.newPointer(1, 0).lineOffset()).isEqualTo(0);
+ assertThat(file.newPointer(1, 0).lineOffset()).isZero();
// Don't fail
file.newPointer(1, 9);
file.newPointer(2, 0);
Metadata metadata = new Metadata(2, 2, "", new int[] {0, 10}, new int[] {8, 15}, 16);
DefaultInputFile file = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), f -> f.setMetadata(metadata));
assertThat(file.newPointer(0).line()).isEqualTo(1);
- assertThat(file.newPointer(0).lineOffset()).isEqualTo(0);
+ assertThat(file.newPointer(0).lineOffset()).isZero();
assertThat(file.newPointer(9).line()).isEqualTo(1);
// Ignore eol characters
assertThat(file.newPointer(9).lineOffset()).isEqualTo(8);
assertThat(file.newPointer(10).line()).isEqualTo(2);
- assertThat(file.newPointer(10).lineOffset()).isEqualTo(0);
+ assertThat(file.newPointer(10).lineOffset()).isZero();
assertThat(file.newPointer(15).line()).isEqualTo(2);
assertThat(file.newPointer(15).lineOffset()).isEqualTo(5);
DefaultInputFile file = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), f -> f.setMetadata(metadata));
assertThat(file.selectLine(1).start().line()).isEqualTo(1);
- assertThat(file.selectLine(1).start().lineOffset()).isEqualTo(0);
+ assertThat(file.selectLine(1).start().lineOffset()).isZero();
assertThat(file.selectLine(1).end().line()).isEqualTo(1);
assertThat(file.selectLine(1).end().lineOffset()).isEqualTo(9);
// Don't fail when selecting empty line
assertThat(file.selectLine(3).start().line()).isEqualTo(3);
- assertThat(file.selectLine(3).start().lineOffset()).isEqualTo(0);
+ assertThat(file.selectLine(3).start().lineOffset()).isZero();
assertThat(file.selectLine(3).end().line()).isEqualTo(3);
- assertThat(file.selectLine(3).end().lineOffset()).isEqualTo(0);
+ assertThat(file.selectLine(3).end().lineOffset()).isZero();
try {
file.selectLine(5);
DefaultInputFile file = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), f -> f.setMetadata(metadata));
TextRange newRange = file.newRange(10, 13);
assertThat(newRange.start().line()).isEqualTo(2);
- assertThat(newRange.start().lineOffset()).isEqualTo(0);
+ assertThat(newRange.start().lineOffset()).isZero();
assertThat(newRange.end().line()).isEqualTo(2);
assertThat(newRange.end().lineOffset()).isEqualTo(3);
}
Metadata metadata = new FileMetadata(analysisWarnings).readMetadata(new FileInputStream(tempFile), StandardCharsets.UTF_8, tempFile.getName());
assertThat(metadata.lines()).isEqualTo(1);
- assertThat(metadata.nonBlankLines()).isEqualTo(0);
+ assertThat(metadata.nonBlankLines()).isZero();
assertThat(metadata.hash()).isNotEmpty();
assertThat(metadata.originalLineStartOffsets()).containsOnly(0);
assertThat(metadata.originalLineEndOffsets()).containsOnly(0);
newRules.add(createRule("key2", "repo", "internal"));
DefaultRules rules = new DefaultRules(newRules);
- assertThat(rules.findByInternalKey("xx", "xx")).hasSize(0);
+ assertThat(rules.findByInternalKey("xx", "xx")).isEmpty();
assertThat(rules.find(RuleKey.of("xxx", "xx"))).isNull();
- assertThat(rules.findByRepository("xxxx")).hasSize(0);
+ assertThat(rules.findByRepository("xxxx")).isEmpty();
}
@Test
@Test
public void default_number_values_are_zero() {
Settings settings = new MapSettings();
- assertThat(settings.getInt("foo")).isEqualTo(0);
+ assertThat(settings.getInt("foo")).isZero();
assertThat(settings.getLong("foo")).isEqualTo(0L);
}
@Test
public void getStringLines_no_value() {
- Assertions.assertThat(new MapSettings().getStringLines("foo")).hasSize(0);
+ Assertions.assertThat(new MapSettings().getStringLines("foo")).isEmpty();
}
@Test
assertThat(settings.getKeysStartingWith("sonar")).containsOnly("sonar.jdbc.url", "sonar.jdbc.username", "sonar.security");
assertThat(settings.getKeysStartingWith("sonar.jdbc")).containsOnly("sonar.jdbc.url", "sonar.jdbc.username");
- assertThat(settings.getKeysStartingWith("other")).hasSize(0);
+ assertThat(settings.getKeysStartingWith("other")).isEmpty();
}
@Test
public void create_from_value_and_unit() {
WorkDuration result = WorkDuration.createFromValueAndUnit(1, WorkDuration.UNIT.DAYS, HOURS_IN_DAY);
assertThat(result.days()).isEqualTo(1);
- assertThat(result.hours()).isEqualTo(0);
- assertThat(result.minutes()).isEqualTo(0);
+ assertThat(result.hours()).isZero();
+ assertThat(result.minutes()).isZero();
assertThat(result.hoursInDay()).isEqualTo(HOURS_IN_DAY);
assertThat(result.toMinutes()).isEqualTo(ONE_DAY_IN_MINUTES);
@Test
public void create_from_minutes() {
WorkDuration workDuration = WorkDuration.createFromMinutes(ONE_MINUTE, HOURS_IN_DAY);
- assertThat(workDuration.days()).isEqualTo(0);
- assertThat(workDuration.hours()).isEqualTo(0);
+ assertThat(workDuration.days()).isZero();
+ assertThat(workDuration.hours()).isZero();
assertThat(workDuration.minutes()).isEqualTo(1);
workDuration = WorkDuration.createFromMinutes(ONE_HOUR_IN_MINUTES, HOURS_IN_DAY);
- assertThat(workDuration.days()).isEqualTo(0);
+ assertThat(workDuration.days()).isZero();
assertThat(workDuration.hours()).isEqualTo(1);
- assertThat(workDuration.minutes()).isEqualTo(0);
+ assertThat(workDuration.minutes()).isZero();
workDuration = WorkDuration.createFromMinutes(ONE_DAY_IN_MINUTES, HOURS_IN_DAY);
assertThat(workDuration.days()).isEqualTo(1);
- assertThat(workDuration.hours()).isEqualTo(0);
- assertThat(workDuration.minutes()).isEqualTo(0);
+ assertThat(workDuration.hours()).isZero();
+ assertThat(workDuration.minutes()).isZero();
}
@Test
public void create_from_working_long() {
// 1 minute
WorkDuration workDuration = WorkDuration.createFromLong(1L, HOURS_IN_DAY);
- assertThat(workDuration.days()).isEqualTo(0);
- assertThat(workDuration.hours()).isEqualTo(0);
+ assertThat(workDuration.days()).isZero();
+ assertThat(workDuration.hours()).isZero();
assertThat(workDuration.minutes()).isEqualTo(1);
// 1 hour
workDuration = WorkDuration.createFromLong(100L, HOURS_IN_DAY);
- assertThat(workDuration.days()).isEqualTo(0);
+ assertThat(workDuration.days()).isZero();
assertThat(workDuration.hours()).isEqualTo(1);
- assertThat(workDuration.minutes()).isEqualTo(0);
+ assertThat(workDuration.minutes()).isZero();
// 1 day
workDuration = WorkDuration.createFromLong(10000L, HOURS_IN_DAY);
assertThat(workDuration.days()).isEqualTo(1);
- assertThat(workDuration.hours()).isEqualTo(0);
- assertThat(workDuration.minutes()).isEqualTo(0);
+ assertThat(workDuration.hours()).isZero();
+ assertThat(workDuration.minutes()).isZero();
}
@Test
WorkDuration result = WorkDuration.createFromValueAndUnit(4, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).add(WorkDuration.createFromValueAndUnit(5, WorkDuration.UNIT.HOURS, HOURS_IN_DAY));
assertThat(result.days()).isEqualTo(1);
assertThat(result.hours()).isEqualTo(1);
- assertThat(result.minutes()).isEqualTo(0);
+ assertThat(result.minutes()).isZero();
assertThat(result.hoursInDay()).isEqualTo(HOURS_IN_DAY);
// 40 m + 30m = 1h 10m
result = WorkDuration.createFromValueAndUnit(40, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY).add(WorkDuration.createFromValueAndUnit(30, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY));
- assertThat(result.days()).isEqualTo(0);
+ assertThat(result.days()).isZero();
assertThat(result.hours()).isEqualTo(1);
assertThat(result.minutes()).isEqualTo(10);
assertThat(result.hoursInDay()).isEqualTo(HOURS_IN_DAY);
public void subtract() {
// 1d 1h - 5h = 4h
WorkDuration result = WorkDuration.create(1, 1, 0, HOURS_IN_DAY).subtract(WorkDuration.createFromValueAndUnit(5, WorkDuration.UNIT.HOURS, HOURS_IN_DAY));
- assertThat(result.days()).isEqualTo(0);
+ assertThat(result.days()).isZero();
assertThat(result.hours()).isEqualTo(4);
- assertThat(result.minutes()).isEqualTo(0);
+ assertThat(result.minutes()).isZero();
assertThat(result.hoursInDay()).isEqualTo(HOURS_IN_DAY);
// 1h 10m - 30m = 40m
result = WorkDuration.create(0, 1, 10, HOURS_IN_DAY).subtract(WorkDuration.createFromValueAndUnit(30, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY));
- assertThat(result.days()).isEqualTo(0);
- assertThat(result.hours()).isEqualTo(0);
+ assertThat(result.days()).isZero();
+ assertThat(result.hours()).isZero();
assertThat(result.minutes()).isEqualTo(40);
assertThat(result.hoursInDay()).isEqualTo(HOURS_IN_DAY);
WorkDuration result = WorkDuration.createFromValueAndUnit(5, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).multiply(2);
assertThat(result.days()).isEqualTo(1);
assertThat(result.hours()).isEqualTo(2);
- assertThat(result.minutes()).isEqualTo(0);
+ assertThat(result.minutes()).isZero();
assertThat(result.hoursInDay()).isEqualTo(HOURS_IN_DAY);
}
assertThat(limits[0]).isEqualTo(4);
assertThat(limits[1]).isEqualTo(2);
- assertThat(limits[2]).isEqualTo(0);
+ assertThat(limits[2]).isZero();
}
@Test
assertThat(emptyAsNull).isNotSameAs(stringParam);
assertThat(emptyAsNull.isPresent()).isTrue();
expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
- assertThat(emptyAsNull.or(() -> "bar")).isEqualTo(null);
- assertThat(emptyAsNull.getValue()).isEqualTo(null);
+ assertThat(emptyAsNull.or(() -> "bar")).isNull();
+ assertThat(emptyAsNull.getValue()).isNull();
}
@Test
assertThat(emptyAsNull).isNotSameAs(stringParam);
assertThat(emptyAsNull.isPresent()).isTrue();
expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
- assertThat(emptyAsNull.or(() -> "bar")).isEqualTo(null);
- assertThat(emptyAsNull.getValue()).isEqualTo(null);
+ assertThat(emptyAsNull.or(() -> "bar")).isNull();
+ assertThat(emptyAsNull.getValue()).isNull();
}
@Test
TaskDefinition bar = TaskDefinition.builder().key("bar").taskClass(FooTask.class).description("Bar").build();
assertThat(foo.compareTo(bar)).isGreaterThan(0);
- assertThat(foo.compareTo(foo)).isEqualTo(0);
+ assertThat(foo).isEqualByComparingTo(foo);
assertThat(bar.compareTo(foo)).isLessThan(0);
}
public void date_to_long() {
Date date = new Date();
assertThat(DateUtils.dateToLong(date)).isEqualTo(date.getTime());
- assertThat(DateUtils.dateToLong(null)).isEqualTo(null);
+ assertThat(DateUtils.dateToLong(null)).isNull();
}
@DataProvider
assertThat(paging.pageIndex()).isEqualTo(1);
assertThat(paging.total()).isEqualTo(20);
- assertThat(paging.offset()).isEqualTo(0);
+ assertThat(paging.offset()).isZero();
assertThat(paging.pages()).isEqualTo(4);
}
@Test
public void test_offset() {
- assertThat(forPageIndex(1).withPageSize(5).andTotal(20).offset()).isEqualTo(0);
+ assertThat(forPageIndex(1).withPageSize(5).andTotal(20).offset()).isZero();
assertThat(forPageIndex(2).withPageSize(5).andTotal(20).offset()).isEqualTo(5);
}
@Test
public void test_compareTo() {
- assertThat(parse("1.2").compareTo(parse("1.2.0"))).isEqualTo(0);
- assertThat(parse("1.2.3").compareTo(parse("1.2.3"))).isEqualTo(0);
+ assertThat(parse("1.2")).isEqualByComparingTo(parse("1.2.0"));
+ assertThat(parse("1.2.3")).isEqualByComparingTo(parse("1.2.3"));
assertThat(parse("1.2.3").compareTo(parse("1.2.4"))).isLessThan(0);
assertThat(parse("1.2.3").compareTo(parse("1.3"))).isLessThan(0);
assertThat(parse("1.2.3").compareTo(parse("2.1"))).isLessThan(0);
@Test
public void compareTo_handles_build_number() {
- assertThat(parse("1.2").compareTo(parse("1.2.0.0"))).isEqualTo(0);
+ assertThat(parse("1.2")).isEqualByComparingTo(parse("1.2.0.0"));
assertThat(parse("1.2.3.1234").compareTo(parse("1.2.3.4567"))).isLessThan(0);
assertThat(parse("1.2.3.1234").compareTo(parse("1.2.3"))).isGreaterThan(0);
assertThat(parse("1.2.3.1234").compareTo(parse("1.2.4"))).isLessThan(0);
public void qualifier_is_ignored_from_comparison() {
assertThat(parse("1.2.3")).isEqualTo(parse("1.2.3-build1"));
assertThat(parse("1.2.3")).isEqualTo(parse("1.2.3-build1"));
- assertThat(parse("1.2.3").compareTo(parse("1.2.3-build1"))).isEqualTo(0);
+ assertThat(parse("1.2.3")).isEqualByComparingTo(parse("1.2.3-build1"));
}
@Test
StreamConsumer stdErrConsumer = line -> stdErrBuilder.append(line).append(SystemUtils.LINE_SEPARATOR);
Command command = Command.create(getScript("output")).setDirectory(workDir);
int exitCode = CommandExecutor.create().execute(command, stdOutConsumer, stdErrConsumer, 1000L);
- assertThat(exitCode).isEqualTo(0);
+ assertThat(exitCode).isZero();
String stdOut = stdOutBuilder.toString();
String stdErr = stdErrBuilder.toString();
.addArgument("1")
.setEnvironmentVariable("ENVVAR", "2");
int exitCode = CommandExecutor.create().execute(command, 1000L);
- assertThat(exitCode).isEqualTo(0);
+ assertThat(exitCode).isZero();
File logFile = new File(workDir, "echo.log");
assertThat(logFile).exists();
String log = FileUtils.readFileToString(logFile);
logger.error(TEST_STR);
logger.info(TEST_STR);
logger.debug(TEST_STR);
- assertThat(out.size()).isEqualTo(0);
+ assertThat(out.size()).isZero();
}
@Test
verifySameContent(result, jar);
// no requests to server
- assertThat(server.getRequestCount()).isEqualTo(0);
+ assertThat(server.getRequestCount()).isZero();
}
@Test
if (otherFileRef != null) {
assertThat(d.getDuplicate(0).getOtherFileRef()).isEqualTo(otherFileRef);
} else {
- assertThat(d.getDuplicate(0).getOtherFileRef()).isEqualTo(0);
+ assertThat(d.getDuplicate(0).getOtherFileRef()).isZero();
}
assertThat(d.getDuplicate(0).getRange().getStartLine()).isEqualTo(rangeStartLine);
assertThat(d.getDuplicate(0).getRange().getEndLine()).isEqualTo(rangeEndLine);
assertThat(context.allExternalIssues()).hasSize(1);
TextRange got = context.allExternalIssues().iterator().next().primaryLocation().textRange();
assertThat(got.start().line()).isEqualTo(input.startLine);
- assertThat(got.start().lineOffset()).isEqualTo(0);
+ assertThat(got.start().lineOffset()).isZero();
assertThat(got.end().line()).isEqualTo(input.startLine);
assertThat(got.end().lineOffset()).isEqualTo(sourceFile.selectLine(input.startLine).end().lineOffset());
}
parser.parse(new File(this.getClass().getResource("coverage.xml").toURI()), context);
assertThat(parser.numberOfMatchedFiles()).isEqualTo(1);
- assertThat(context.lineHits(fileWithoutBranch.key(), 2)).isEqualTo(0);
+ assertThat(context.lineHits(fileWithoutBranch.key(), 2)).isZero();
assertThat(context.lineHits(fileWithoutBranch.key(), 3)).isEqualTo(1);
assertThat(context.lineHits(fileWithoutBranch.key(), 4)).isNull();
assertThat(context.lineHits(fileWithoutBranch.key(), 5)).isEqualTo(1);
- assertThat(context.lineHits(fileWithoutBranch.key(), 6)).isEqualTo(0);
+ assertThat(context.lineHits(fileWithoutBranch.key(), 6)).isZero();
}
@Test
assertThat(context.conditions(fileWithBranches.key(), 4)).isEqualTo(2);
assertThat(context.coveredConditions(fileWithBranches.key(), 3)).isEqualTo(5);
- assertThat(context.coveredConditions(fileWithBranches.key(), 4)).isEqualTo(0);
+ assertThat(context.coveredConditions(fileWithBranches.key(), 4)).isZero();
}
@Test(expected = MessageException.class)
public void testNoConfiguration() {
patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
assertThat(patternsInitializer.hasConfiguredPatterns()).isFalse();
- assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isEqualTo(0);
+ assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isZero();
}
@Test(expected = MessageException.class)
assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue();
assertThat(patternsInitializer.hasFileContentPattern()).isTrue();
assertThat(patternsInitializer.hasMulticriteriaPatterns()).isFalse();
- assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isEqualTo(0);
+ assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isZero();
assertThat(patternsInitializer.getBlockPatterns().size()).isEqualTo(3);
- assertThat(patternsInitializer.getAllFilePatterns().size()).isEqualTo(0);
+ assertThat(patternsInitializer.getAllFilePatterns().size()).isZero();
}
@Test(expected = MessageException.class)
assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue();
assertThat(patternsInitializer.hasFileContentPattern()).isTrue();
assertThat(patternsInitializer.hasMulticriteriaPatterns()).isFalse();
- assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isEqualTo(0);
- assertThat(patternsInitializer.getBlockPatterns().size()).isEqualTo(0);
+ assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isZero();
+ assertThat(patternsInitializer.getBlockPatterns().size()).isZero();
assertThat(patternsInitializer.getAllFilePatterns().size()).isEqualTo(2);
}
assertThat(result.coverageFor(file, 1)).isNull();
assertThat(result.coverageFor(file, 2).getHits()).isFalse();
- assertThat(result.coverageFor(file, 2).getConditions()).isEqualTo(0);
- assertThat(result.coverageFor(file, 2).getCoveredConditions()).isEqualTo(0);
+ assertThat(result.coverageFor(file, 2).getConditions()).isZero();
+ assertThat(result.coverageFor(file, 2).getCoveredConditions()).isZero();
assertThat(result.coverageFor(file, 3).getHits()).isFalse();
assertThat(result.coverageFor(file, 4)).isNull();
assertThat(result.coverageFor(file1, 1)).isNull();
assertThat(result.coverageFor(file1, 2).getHits()).isFalse();
- assertThat(result.coverageFor(file1, 2).getConditions()).isEqualTo(0);
- assertThat(result.coverageFor(file1, 2).getCoveredConditions()).isEqualTo(0);
+ assertThat(result.coverageFor(file1, 2).getConditions()).isZero();
+ assertThat(result.coverageFor(file1, 2).getCoveredConditions()).isZero();
assertThat(result.coverageFor(file1, 3).getHits()).isFalse();
assertThat(result.coverageFor(file1, 4)).isNull();
InputFile noConditions = result.inputFile("xources/hello/NoConditions.xoo");
assertThat(result.coverageFor(noConditions, 6).getHits()).isTrue();
- assertThat(result.coverageFor(noConditions, 6).getConditions()).isEqualTo(0);
- assertThat(result.coverageFor(noConditions, 6).getCoveredConditions()).isEqualTo(0);
+ assertThat(result.coverageFor(noConditions, 6).getConditions()).isZero();
+ assertThat(result.coverageFor(noConditions, 6).getCoveredConditions()).isZero();
assertThat(result.coverageFor(noConditions, 7).getHits()).isFalse();
InputFile noConditions = result.inputFile("xources/hello/NoConditions.xoo");
assertThat(result.coverageFor(noConditions, 6).getHits()).isTrue();
- assertThat(result.coverageFor(noConditions, 6).getConditions()).isEqualTo(0);
- assertThat(result.coverageFor(noConditions, 6).getCoveredConditions()).isEqualTo(0);
+ assertThat(result.coverageFor(noConditions, 6).getConditions()).isZero();
+ assertThat(result.coverageFor(noConditions, 6).getCoveredConditions()).isZero();
assertThat(result.coverageFor(noConditions, 7).getHits()).isTrue();
// precise issue location
ExternalIssue issue = externalIssues.get(0);
- assertThat(issue.getFlowCount()).isZero();
- assertThat(issue.getMsg()).isEqualTo("fix the issue here");
- assertThat(issue.getEngineId()).isEqualTo("externalXoo");
- assertThat(issue.getRuleId()).isEqualTo("rule1");
- assertThat(issue.getSeverity()).isEqualTo(Severity.MAJOR);
- assertThat(issue.getEffort()).isEqualTo(50l);
- assertThat(issue.getType()).isEqualTo(IssueType.CODE_SMELL);
- assertThat(issue.getTextRange().getStartLine()).isEqualTo(5);
- assertThat(issue.getTextRange().getEndLine()).isEqualTo(5);
- assertThat(issue.getTextRange().getStartOffset()).isEqualTo(3);
- assertThat(issue.getTextRange().getEndOffset()).isEqualTo(41);
+ assertPreciseIssueLocation(issue);
// location on a line
issue = externalIssues.get(1);
- assertThat(issue.getFlowCount()).isZero();
- assertThat(issue.getMsg()).isEqualTo("fix the bug here");
- assertThat(issue.getEngineId()).isEqualTo("externalXoo");
- assertThat(issue.getRuleId()).isEqualTo("rule2");
- assertThat(issue.getSeverity()).isEqualTo(Severity.CRITICAL);
- assertThat(issue.getType()).isEqualTo(IssueType.BUG);
- assertThat(issue.getEffort()).isZero();
- assertThat(issue.getTextRange().getStartLine()).isEqualTo(3);
- assertThat(issue.getTextRange().getEndLine()).isEqualTo(3);
- assertThat(issue.getTextRange().getStartOffset()).isEqualTo(0);
- assertThat(issue.getTextRange().getEndOffset()).isEqualTo(24);
+ assertIssueLocationLine(issue);
// One file-level issue in helloscala, with secondary location
List<ExternalIssue> externalIssues2 = result.externalIssuesFor(result.inputFile("xources/hello/helloscala.xoo"));
assertThat(externalIssues2).hasSize(1);
issue = externalIssues2.iterator().next();
+ assertSecondaryLocation(issue);
+
+ // one issue is located in a non-existing file
+ assertThat(logs.logs()).contains("External issues ignored for 1 unknown files, including: invalidFile");
+
+ }
+
+ private void assertSecondaryLocation(ExternalIssue issue) {
assertThat(issue.getFlowCount()).isEqualTo(2);
assertThat(issue.getMsg()).isEqualTo("fix the bug here");
assertThat(issue.getEngineId()).isEqualTo("externalXoo");
assertThat(issue.getFlow(0).getLocation(0).getTextRange().getStartLine()).isOne();
assertThat(issue.getFlow(1).getLocationCount()).isOne();
assertThat(issue.getFlow(1).getLocation(0).getTextRange().getStartLine()).isEqualTo(3);
+ }
- // one issue is located in a non-existing file
- assertThat(logs.logs()).contains("External issues ignored for 1 unknown files, including: invalidFile");
+ private void assertIssueLocationLine(ExternalIssue issue) {
+ assertThat(issue.getFlowCount()).isZero();
+ assertThat(issue.getMsg()).isEqualTo("fix the bug here");
+ assertThat(issue.getEngineId()).isEqualTo("externalXoo");
+ assertThat(issue.getRuleId()).isEqualTo("rule2");
+ assertThat(issue.getSeverity()).isEqualTo(Severity.CRITICAL);
+ assertThat(issue.getType()).isEqualTo(IssueType.BUG);
+ assertThat(issue.getEffort()).isZero();
+ assertThat(issue.getTextRange().getStartLine()).isEqualTo(3);
+ assertThat(issue.getTextRange().getEndLine()).isEqualTo(3);
+ assertThat(issue.getTextRange().getStartOffset()).isZero();
+ assertThat(issue.getTextRange().getEndOffset()).isEqualTo(24);
+ }
+ private void assertPreciseIssueLocation(ExternalIssue issue) {
+ assertThat(issue.getFlowCount()).isZero();
+ assertThat(issue.getMsg()).isEqualTo("fix the issue here");
+ assertThat(issue.getEngineId()).isEqualTo("externalXoo");
+ assertThat(issue.getRuleId()).isEqualTo("rule1");
+ assertThat(issue.getSeverity()).isEqualTo(Severity.MAJOR);
+ assertThat(issue.getEffort()).isEqualTo(50l);
+ assertThat(issue.getType()).isEqualTo(IssueType.CODE_SMELL);
+ assertThat(issue.getTextRange().getStartLine()).isEqualTo(5);
+ assertThat(issue.getTextRange().getEndLine()).isEqualTo(5);
+ assertThat(issue.getTextRange().getStartOffset()).isEqualTo(3);
+ assertThat(issue.getTextRange().getEndOffset()).isEqualTo(41);
}
}
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Specifying module-relative paths at project level in property 'sonar.issue.ignore.multicriteria' is deprecated. To continue matching files like 'moduleA/src/sampleA.xoo', update this property so that patterns refer to project-relative paths.");
List<Issue> issues = result.issuesFor(result.inputFile("moduleA/src/sampleA.xoo"));
- assertThat(issues).hasSize(0);
+ assertThat(issues).isEmpty();
issues = result.issuesFor(result.inputFile("moduleB/src/sampleB.xoo"));
assertThat(issues).hasSize(10);
assertThat(issues).hasSize(10);
issues = result.issuesFor(result.inputFile("moduleB/src/sampleB.xoo"));
- assertThat(issues).hasSize(0);
+ assertThat(issues).isEmpty();
}
private void activateTODORule() {
Component rootProtobuf = reader.readComponent(1);
assertThat(rootProtobuf.getKey()).isEqualTo("foo");
assertThat(rootProtobuf.getDescription()).isEqualTo("Root description");
- assertThat(rootProtobuf.getLinkCount()).isEqualTo(0);
+ assertThat(rootProtobuf.getLinkCount()).isZero();
assertThat(reader.readComponent(4).getStatus()).isEqualTo(FileStatus.SAME);
assertThat(reader.readComponent(6).getStatus()).isEqualTo(FileStatus.CHANGED);
assertThat(rootProtobuf.getKey()).isEqualTo("foo");
assertThat(rootProtobuf.getName()).isEqualTo("");
assertThat(rootProtobuf.getDescription()).isEqualTo("Root description");
- assertThat(rootProtobuf.getLinkCount()).isEqualTo(0);
+ assertThat(rootProtobuf.getLinkCount()).isZero();
}
@Test
when(validation.isUTF16(any(byte[].class), anyBoolean())).thenReturn(new Result(Validation.MAYBE, null));
when(validation.isValidWindows1252(any(byte[].class))).thenReturn(Result.INVALID);
- assertThat(charsets.detect(new byte[1])).isEqualTo(null);
+ assertThat(charsets.detect(new byte[1])).isNull();
}
@Test
when(validation.isUTF16(any(byte[].class), anyBoolean())).thenReturn(Result.newValid(StandardCharsets.UTF_16));
when(validation.isValidUTF16(any(byte[].class), anyBoolean())).thenReturn(true);
- assertThat(charsets.detect(new byte[1])).isEqualTo(null);
+ assertThat(charsets.detect(new byte[1])).isNull();
}
@Test
repository.addFileDataToModule("module1", null, fileData);
- assertThat(repository.repositoriesByModule()).hasSize(0);
+ assertThat(repository.repositoriesByModule()).isEmpty();
}
@Test
repository.addFileDataToModule("module2", "/Abc.java", fileData);
- assertThat(repository.repositoriesByModule()).hasSize(0);
+ assertThat(repository.repositoriesByModule()).isEmpty();
}
}
repository.addFileData(null, fileData);
- assertThat(repository.fileData()).hasSize(0);
+ assertThat(repository.fileData()).isEmpty();
}
@Test
repository.addFileData("/Abc.java", fileData);
- assertThat(repository.fileData()).hasSize(0);
+ assertThat(repository.fileData()).isEmpty();
}
}