]> source.dussan.org Git - sonarqube.git/commitdiff
fix code smells
authorPierre <pierre.guillot@sonarsource.com>
Fri, 11 Dec 2020 16:20:41 +0000 (17:20 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 14 Dec 2020 20:07:14 +0000 (20:07 +0000)
141 files changed:
server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapSearchTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/MatchesByScoreTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/SourceSimilarityImplTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/DoubleValueTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/IntValueTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/AdHocRuleCreatorTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerReferenceBranchInputFactoryTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PostMeasuresComputationChecksStepTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/PersistFileSourcesStepTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/linereader/CoverageLineReaderTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAdHocRulesStepTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAnalysisPropertiesStepTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java
server/sonar-ce-task/src/test/java/org/sonar/ce/task/container/TaskContainerImplTest.java
server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CommonCEQueueStatusImplTest.java
server/sonar-db-core/src/test/java/org/sonar/db/profiling/SqlLogFormatterTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeQueueDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskCharacteristicDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskInputDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ProjectLinkDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/duplication/DuplicationDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/es/EsQueueDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/notification/NotificationQueueDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/permission/PermissionQueryTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/project/ProjectDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/property/InternalComponentPropertiesDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDeliveryDaoTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/history/MigrationHistoryTableImplTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/UpsertImplTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest.java
server/sonar-main/src/test/java/org/sonar/application/es/EsLoggingTest.java
server/sonar-process/src/test/java/org/sonar/process/FileUtils2Test.java
server/sonar-process/src/test/java/org/sonar/process/logging/Log4JPropertiesBuilderTest.java
server/sonar-process/src/test/java/org/sonar/process/logging/LogLevelConfigTest.java
server/sonar-process/src/test/java/org/sonar/process/logging/LogbackHelperTest.java
server/sonar-server-common/src/test/java/org/sonar/server/component/index/ComponentIndexerTest.java
server/sonar-server-common/src/test/java/org/sonar/server/es/BulkIndexerConcurrentRequestCalculationTest.java
server/sonar-server-common/src/test/java/org/sonar/server/es/BulkIndexerTest.java
server/sonar-server-common/src/test/java/org/sonar/server/es/IndexingResultTest.java
server/sonar-server-common/src/test/java/org/sonar/server/es/SearchOptionsTest.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java
server/sonar-server-common/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexerTest.java
server/sonar-server-common/src/test/java/org/sonar/server/notification/DefaultNotificationManagerTest.java
server/sonar-server-common/src/test/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProviderTest.java
server/sonar-server-common/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest.java
server/sonar-server-common/src/test/java/org/sonar/server/rule/index/RuleIndexTest.java
server/sonar-server-common/src/test/java/org/sonar/server/webhook/SynchronousWebHooksImplTest.java
server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
server/sonar-webserver-core/src/test/java/org/sonar/server/ce/http/CeHttpClientImplTest.java
server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationMediumTest.java
server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java
server/sonar-webserver-es/src/test/java/org/sonar/server/es/IndexCreatorTest.java
server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/TreeActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/SearchActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/WebIssueStorageTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/live/LiveMeasureComputerImplTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/metric/ws/CreateActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/newcodeperiod/ws/UnsetActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/NotificationCenterTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/organization/ws/OrganizationDeleterTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileRuleImplTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/SearchActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/CheckSecretKeyActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/GenerateSecretKeyActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/DeleteActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookDeliveriesActionTest.java
sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
sonar-core/src/test/java/org/sonar/core/issue/FieldDiffsTest.java
sonar-core/src/test/java/org/sonar/core/issue/tracking/BlockRecognizerTest.java
sonar-core/src/test/java/org/sonar/core/issue/tracking/TrackerTest.java
sonar-core/src/test/java/org/sonar/core/util/logs/NullProfilerTest.java
sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputFileTest.java
sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/FileMetadataTest.java
sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/rule/internal/DefaultRulesTest.java
sonar-plugin-api-impl/src/test/java/org/sonar/api/config/internal/MapSettingsTest.java
sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/WorkDurationTest.java
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/RangeDistributionBuilderTest.java
sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java
sonar-plugin-api/src/test/java/org/sonar/api/task/TaskDefinitionTest.java
sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java
sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java
sonar-plugin-api/src/test/java/org/sonar/api/utils/VersionTest.java
sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PluginFilesTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/externalissue/ExternalIssueImporterTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParserTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ByteCharsetDetectorTest.java
sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/input/MultiModuleProjectRepositoryTest.java
sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/input/SingleProjectRepositoryTest.java

index c46bc6f310708be71a5372988b92d85a15251fe9..56b818ba53f9e38f96b8a1705621056e9f7c963e 100644 (file)
@@ -83,7 +83,7 @@ public class LdapSearchTest {
     assertThat(search.getParameters()).isEqualTo(new String[] {"inetOrgPerson"});
     assertThat(search.getReturningAttributes()).isEqualTo(new String[] {"cn"});
     assertThat(search.toString()).isEqualTo("LdapSearch{baseDn=dc=example,dc=org, scope=onelevel, request=(objectClass={0}), parameters=[inetOrgPerson], attributes=[cn]}");
-    assertThat(enumerationToArrayList(search.find()).size()).isEqualTo(0);
+    assertThat(enumerationToArrayList(search.find()).size()).isZero();
     assertThat(search.findUnique()).isNull();
   }
 
index ed1f581e66d67c9e3dd887b8261b2a8fe9825d6c..7bdd0b3f334ff8b7ef23e60802f06744c88ee608 100644 (file)
@@ -43,7 +43,7 @@ public class MatchesByScoreTest {
     ScoreMatrix scoreMatrix1 = new ScoreMatrix(doesNotMatterRemovedFiles, doesNotMatterNewFiles, doesNotMatterScores, MIN_REQUIRED_SCORE - 1);
     MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix1);
 
-    assertThat(matchesByScore.getSize()).isEqualTo(0);
+    assertThat(matchesByScore.getSize()).isZero();
     assertThat(matchesByScore).isEmpty();
 
     ScoreMatrix scoreMatrix2 = new ScoreMatrix(doesNotMatterRemovedFiles, doesNotMatterNewFiles, doesNotMatterScores, MIN_REQUIRED_SCORE - 5);
index d77d7327a76fd2fd62565292be417fdfb00fce6a..86eb96a773bafb5fb2776e83196fdd58fcef421b 100644 (file)
@@ -41,7 +41,7 @@ public class SourceSimilarityImplTest {
   public void zero_if_fully_different() {
     List<String> left = asList("a", "b", "c");
     List<String> right = asList("d", "e");
-    assertThat(underTest.score(left, right)).isEqualTo(0);
+    assertThat(underTest.score(left, right)).isZero();
   }
 
   @Test
@@ -127,6 +127,6 @@ public class SourceSimilarityImplTest {
 
   @Test
   public void two_empty_lists_are_not_considered_as_equal() {
-    assertThat(underTest.score(emptyList(), emptyList())).isEqualTo(0);
+    assertThat(underTest.score(emptyList(), emptyList())).isZero();
   }
 }
index 7b5d7fc8008fe26f66589e3beeed84a17c0179e7..1da21f2c9d277e6978aa87a11f9c4275cbd3fee3 100644 (file)
@@ -72,7 +72,7 @@ public class DoubleValueTest {
 
   private static void verifyUnsetVariationValue(DoubleValue variationValue) {
     assertThat(variationValue.isSet()).isFalse();
-    assertThat(variationValue.getValue()).isEqualTo(0);
+    assertThat(variationValue.getValue()).isZero();
   }
 
   private static void verifySetVariationValue(DoubleValue variationValue, double expected) {
index 339ba5a2909303fb1c2866ffd717948979493d87..4fd80d5dbf329f67832eb38246d0c767e878dad9 100644 (file)
@@ -72,7 +72,7 @@ public class IntValueTest {
 
   private static void verifyUnsetVariationValue(IntValue variationValue) {
     assertThat(variationValue.isSet()).isFalse();
-    assertThat(variationValue.getValue()).isEqualTo(0);
+    assertThat(variationValue.getValue()).isZero();
   }
 
   private static void verifySetVariationValue(IntValue variationValue, int expected) {
index 46a427db219a6b5da17a0052579964da8d1b4404..3a1157243be3840e9956f41b5e72264184ac8138 100644 (file)
@@ -63,7 +63,7 @@ public class AdHocRuleCreatorTest {
     assertThat(rule.getName()).isEqualTo("eslint:no-cond-assign");
     assertThat(rule.getDescription()).isNull();
     assertThat(rule.getSeverity()).isNull();
-    assertThat(rule.getType()).isEqualTo(0);
+    assertThat(rule.getType()).isZero();
     assertThat(rule.getMetadata().getAdHocName()).isNull();
     assertThat(rule.getMetadata().getAdHocDescription()).isNull();
     assertThat(rule.getMetadata().getAdHocSeverity()).isNull();
@@ -91,7 +91,7 @@ public class AdHocRuleCreatorTest {
     assertThat(rule.getName()).isEqualTo("eslint:no-cond-assign");
     assertThat(rule.getDescription()).isNull();
     assertThat(rule.getSeverity()).isNull();
-    assertThat(rule.getType()).isEqualTo(0);
+    assertThat(rule.getType()).isZero();
     assertThat(rule.getMetadata().getAdHocName()).isEqualTo("No condition assigned");
     assertThat(rule.getMetadata().getAdHocDescription()).isEqualTo("A description");
     assertThat(rule.getMetadata().getAdHocSeverity()).isEqualTo(Severity.BLOCKER);
@@ -146,7 +146,7 @@ public class AdHocRuleCreatorTest {
     assertThat(ruleUpdated.getName()).isEqualTo("eslint:no-cond-assign");
     assertThat(ruleUpdated.getDescription()).isNull();
     assertThat(ruleUpdated.getSeverity()).isNull();
-    assertThat(ruleUpdated.getType()).isEqualTo(0);
+    assertThat(ruleUpdated.getType()).isZero();
     assertThat(ruleUpdated.getMetadata().getAdHocName()).isEqualTo("No condition assigned updated");
     assertThat(ruleUpdated.getMetadata().getAdHocDescription()).isEqualTo("A description updated");
     assertThat(ruleUpdated.getMetadata().getAdHocSeverity()).isEqualTo(Severity.CRITICAL);
index acad6933890b3dee9bccf866b26ea30180c19e83..9554769ed3b1d97d2307ab8cdb8f5e691ad6c7de 100644 (file)
@@ -264,7 +264,7 @@ public class IntegrateIssuesVisitorTest {
     underTest.visitAny(FILE);
 
     List<DefaultIssue> issues = newArrayList(protoIssueCache.traverse());
-    assertThat(issues).hasSize(0);
+    assertThat(issues).isEmpty();
   }
 
   @Test
index 6cf74ec1b747c86d8d9ee66fdf267081f7aeeeb0..ee470cf27990b66af060e4af966403d529b640e1 100644 (file)
@@ -76,6 +76,6 @@ public class TrackerReferenceBranchInputFactoryTest {
     Input<DefaultIssue> input = underTest.create(component);
 
     assertThat(input.getIssues()).isEmpty();
-    assertThat(input.getLineHashSequence().length()).isEqualTo(0);
+    assertThat(input.getLineHashSequence().length()).isZero();
   }
 }
index a26fe052f0c0b0a1ce609521dd8bbfd4aa6eea3e..dee477693ab75be8d11b3b22c540f216ac682061 100644 (file)
@@ -103,7 +103,7 @@ public class PostMeasuresComputationChecksStepTest {
 
     ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
     verify(check).onCheck(contextArgumentCaptor.capture());
-    assertThat(contextArgumentCaptor.getValue().getNcloc()).isEqualTo(0);
+    assertThat(contextArgumentCaptor.getValue().getNcloc()).isZero();
   }
 
   @Test
index 95ff232ff99e5baa617ba893682854fb4853b7cf..665fa2bc02a4b9bd3878996892d35adf9c9ed21f 100644 (file)
@@ -220,7 +220,7 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
     assertThat(data.getLines(1).getScmRevision()).isEmpty();
 
     assertThat(data.getLines(2).getScmAuthor()).isEmpty();
-    assertThat(data.getLines(2).getScmDate()).isEqualTo(0);
+    assertThat(data.getLines(2).getScmDate()).isZero();
     assertThat(data.getLines(2).getScmRevision()).isEmpty();
     verify(fileSourceDataWarnings).commitWarnings();
   }
index 2e9cd1d89fef0787b14045fef36510fe36d93cfd..248aea409e0bc347433791ae01f462a9b896fa97 100644 (file)
@@ -73,7 +73,7 @@ public class CoverageLineReaderTest {
     assertThat(computeCoverageLine.read(lineBuilder)).isEmpty();
 
     assertThat(lineBuilder.hasLineHits()).isTrue();
-    assertThat(lineBuilder.getLineHits()).isEqualTo(0);
+    assertThat(lineBuilder.getLineHits()).isZero();
   }
 
   @Test
index 2aa58c65beb57bb4078915192fc3970464f1e179..5221e2f6a778fe60f44b2b2525beb1b46b5366ee 100644 (file)
@@ -87,7 +87,7 @@ public class PersistAdHocRulesStepTest extends BaseStepTest {
     assertThat(reloaded.getRepositoryKey()).isEqualTo("external_eslint");
     assertThat(reloaded.isExternal()).isTrue();
     assertThat(reloaded.isAdHoc()).isTrue();
-    assertThat(reloaded.getType()).isEqualTo(0);
+    assertThat(reloaded.getType()).isZero();
     assertThat(reloaded.getSeverity()).isNull();
     assertThat(reloaded.getName()).isEqualTo("eslint:no-cond-assign");
 
index c1f87990a15cfff54e862dc5e32a1791415eaa88..26ce6586c8826146e48d51979c4e59fcf2922231 100644 (file)
@@ -110,7 +110,7 @@ public class PersistAnalysisPropertiesStepTest {
 
     underTest.execute(new TestComputationStepContext());
 
-    assertThat(dbTester.countRowsOfTable("analysis_properties")).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable("analysis_properties")).isZero();
   }
 
   @Test
@@ -121,7 +121,7 @@ public class PersistAnalysisPropertiesStepTest {
 
     underTest.execute(new TestComputationStepContext());
 
-    assertThat(dbTester.countRowsOfTable("analysis_properties")).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable("analysis_properties")).isZero();
   }
 
   @Test
index 2175648c8a4936830b33dd4aa03eb82dd24630e7..80179632e239f2186d64fb9363c8fa901e9b0fba 100644 (file)
@@ -141,7 +141,7 @@ public class PersistCrossProjectDuplicationIndexStepTest {
     TestComputationStepContext context = new TestComputationStepContext();
     underTest.execute(context);
 
-    assertThat(dbTester.countRowsOfTable("duplications_index")).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable("duplications_index")).isZero();
     context.getStatistics().assertValue("inserts", 0);
   }
 
@@ -153,7 +153,7 @@ public class PersistCrossProjectDuplicationIndexStepTest {
     TestComputationStepContext context = new TestComputationStepContext();
     underTest.execute(context);
 
-    assertThat(dbTester.countRowsOfTable("duplications_index")).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable("duplications_index")).isZero();
     context.getStatistics().assertValue("inserts", null);
   }
 
index a5c16b027450e282d1f85155f535923874f0209b..655e7f6d2176cf3cc9ba30b92e7c6be20a0bd6b3 100644 (file)
@@ -165,7 +165,7 @@ public class PersistDuplicationDataStepTest extends BaseStepTest {
   }
 
   private void assertThatNothingPersisted() {
-    assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isZero();
   }
 
   private Optional<String> selectMeasureData(String componentUuid) {
index 9af840e7d1befeae273d5815e01e2b06d5f6326a..40ea74a013cb11429c0230bafc18d3c8669200bd 100644 (file)
@@ -265,7 +265,7 @@ public class QualityGateEventsStepTest {
     assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey());
     assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName());
     assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getProjectVersion());
-    assertThat(notification.getFieldValue("branch")).isEqualTo(null);
+    assertThat(notification.getFieldValue("branch")).isNull();
 
     reset(measureRepository, eventRepository, notificationService);
   }
index ba9959421129b11703afeedc20b14ed8163b92fa..1a22d2e5b79335b05af0a169e47d9db398a9d53f 100644 (file)
@@ -67,10 +67,10 @@ public class TaskContainerImplTest {
     });
     ceContainer.bootup();
 
-    assertThat(defaultStartable.startCalls).isEqualTo(0);
-    assertThat(defaultStartable.stopCalls).isEqualTo(0);
+    assertThat(defaultStartable.startCalls).isZero();
+    assertThat(defaultStartable.stopCalls).isZero();
     assertThat(eagerStartable.startCalls).isEqualTo(1);
-    assertThat(eagerStartable.stopCalls).isEqualTo(0);
+    assertThat(eagerStartable.stopCalls).isZero();
   }
 
   @Test
@@ -85,8 +85,8 @@ public class TaskContainerImplTest {
 
     ceContainer.close();
 
-    assertThat(defaultStartable.startCalls).isEqualTo(0);
-    assertThat(defaultStartable.stopCalls).isEqualTo(0);
+    assertThat(defaultStartable.startCalls).isZero();
+    assertThat(defaultStartable.stopCalls).isZero();
     assertThat(eagerStartable.startCalls).isEqualTo(1);
     assertThat(eagerStartable.stopCalls).isEqualTo(1);
   }
index ff9128e32aeccd24e34c970a4c32d5c068f3c13d..b8ecf76066d90446187ff467b07202c9fc723b26 100644 (file)
@@ -53,10 +53,10 @@ public abstract class CommonCEQueueStatusImplTest {
 
   @Test
   public void verify_just_created_instance_metrics() {
-    assertThat(getUnderTest().getInProgressCount()).isEqualTo(0);
-    assertThat(getUnderTest().getErrorCount()).isEqualTo(0);
-    assertThat(getUnderTest().getSuccessCount()).isEqualTo(0);
-    assertThat(getUnderTest().getProcessingTime()).isEqualTo(0);
+    assertThat(getUnderTest().getInProgressCount()).isZero();
+    assertThat(getUnderTest().getErrorCount()).isZero();
+    assertThat(getUnderTest().getSuccessCount()).isZero();
+    assertThat(getUnderTest().getProcessingTime()).isZero();
   }
 
   @Test
@@ -64,9 +64,9 @@ public abstract class CommonCEQueueStatusImplTest {
     getUnderTest().addInProgress();
 
     assertThat(getUnderTest().getInProgressCount()).isEqualTo(1);
-    assertThat(getUnderTest().getErrorCount()).isEqualTo(0);
-    assertThat(getUnderTest().getSuccessCount()).isEqualTo(0);
-    assertThat(getUnderTest().getProcessingTime()).isEqualTo(0);
+    assertThat(getUnderTest().getErrorCount()).isZero();
+    assertThat(getUnderTest().getSuccessCount()).isZero();
+    assertThat(getUnderTest().getProcessingTime()).isZero();
   }
 
   @Test
@@ -77,7 +77,7 @@ public abstract class CommonCEQueueStatusImplTest {
     }
 
     assertThat(getUnderTest().getInProgressCount()).isEqualTo(calls);
-    assertThat(getUnderTest().getProcessingTime()).isEqualTo(0);
+    assertThat(getUnderTest().getProcessingTime()).isZero();
   }
 
   @Test
@@ -94,7 +94,7 @@ public abstract class CommonCEQueueStatusImplTest {
 
     assertThat(getUnderTest().getInProgressCount()).isEqualTo(-1);
     assertThat(getUnderTest().getErrorCount()).isEqualTo(1);
-    assertThat(getUnderTest().getSuccessCount()).isEqualTo(0);
+    assertThat(getUnderTest().getSuccessCount()).isZero();
     assertThat(getUnderTest().getProcessingTime()).isEqualTo(SOME_PROCESSING_TIME);
   }
 
@@ -123,7 +123,7 @@ public abstract class CommonCEQueueStatusImplTest {
     getUnderTest().addSuccess(SOME_PROCESSING_TIME);
 
     assertThat(getUnderTest().getInProgressCount()).isEqualTo(-1);
-    assertThat(getUnderTest().getErrorCount()).isEqualTo(0);
+    assertThat(getUnderTest().getErrorCount()).isZero();
     assertThat(getUnderTest().getSuccessCount()).isEqualTo(1);
     assertThat(getUnderTest().getProcessingTime()).isEqualTo(SOME_PROCESSING_TIME);
   }
index 93cb7390124fde8eb6e82f7bab19b8670610e4b9..98dbbe0626537ddc13d0327404b7264146f79539 100644 (file)
@@ -74,7 +74,7 @@ public class SqlLogFormatterTest {
 
   @Test
   public void countArguments() {
-    assertThat(SqlLogFormatter.countArguments("select * from issues")).isEqualTo(0);
+    assertThat(SqlLogFormatter.countArguments("select * from issues")).isZero();
     assertThat(SqlLogFormatter.countArguments("select * from issues where id=?")).isEqualTo(1);
     assertThat(SqlLogFormatter.countArguments("select * from issues where id=? and kee=?")).isEqualTo(2);
   }
index c6d08a72d11f1037e5a02435f979f198c2cf3b47..faf9cee5e2728e02b1d55b2871f2be5e0bbfa672 100644 (file)
@@ -129,7 +129,7 @@ public class CeActivityDaoTest {
     insertWarnings(tasks[2], 1);
 
     assertThat(underTest.selectByUuid(dbSession, tasks[0].getUuid()).get().getWarningCount()).isEqualTo(moreThan1);
-    assertThat(underTest.selectByUuid(dbSession, tasks[1].getUuid()).get().getWarningCount()).isEqualTo(0);
+    assertThat(underTest.selectByUuid(dbSession, tasks[1].getUuid()).get().getWarningCount()).isZero();
     assertThat(underTest.selectByUuid(dbSession, tasks[2].getUuid()).get().getWarningCount()).isEqualTo(1);
   }
 
index 3af142c4223484b284a1ee3d177ed916d5c8dafc..c200245a044ffb2bad067c335b98d23aaedec5ec 100644 (file)
@@ -246,7 +246,7 @@ public class CeQueueDaoTest {
     insertPending(TASK_UUID_2, MAIN_COMPONENT_UUID_1);
 
     int deletedCount = underTest.deleteByUuid(db.getSession(), "UNKNOWN");
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_1)).isPresent();
 
     deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_1);
@@ -264,15 +264,15 @@ public class CeQueueDaoTest {
     insertInProgress(TASK_UUID_2, MAIN_COMPONENT_UUID_1);
 
     int deletedCount = underTest.deleteByUuid(db.getSession(), "UNKNOWN", null);
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_1)).isPresent();
 
     deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_1, new DeleteIf(IN_PROGRESS));
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_1)).isPresent();
 
     deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_2, new DeleteIf(PENDING));
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectByUuid(db.getSession(), TASK_UUID_2)).isPresent();
 
     deletedCount = underTest.deleteByUuid(db.getSession(), TASK_UUID_1, new DeleteIf(PENDING));
@@ -519,7 +519,7 @@ public class CeQueueDaoTest {
     int total = underTest.countByQuery(db.getSession(), query);
 
     assertThat(result).isEmpty();
-    assertThat(total).isEqualTo(0);
+    assertThat(total).isZero();
   }
 
   @Test
@@ -536,7 +536,7 @@ public class CeQueueDaoTest {
     int total = underTest.countByQuery(db.getSession(), query);
 
     assertThat(result).isEmpty();
-    assertThat(total).isEqualTo(0);
+    assertThat(total).isZero();
   }
 
   @Test
@@ -553,7 +553,7 @@ public class CeQueueDaoTest {
     int total = underTest.countByQuery(db.getSession(), query);
 
     assertThat(result).isEmpty();
-    assertThat(total).isEqualTo(0);
+    assertThat(total).isZero();
   }
 
   @Test
index 7dedd7a9d15f5bb9921c512c757d7a7117ff3f57..b466fd8bb0d8e632f58d73a086a31d0447be1710 100644 (file)
@@ -63,9 +63,9 @@ public class CeTaskCharacteristicDaoTest {
     insert("key3", "value3", "uuid3", "task3");
 
     underTest.deleteByTaskUuids(dbTester.getSession(), ImmutableSet.of("task1", "task3"));
-    assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task1"))).hasSize(0);
+    assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task1"))).isEmpty();
     assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task2"))).hasSize(1);
-    assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task3"))).hasSize(0);
+    assertThat(underTest.selectByTaskUuids(dbTester.getSession(), singletonList("task3"))).isEmpty();
   }
 
   @Test
index d11a6687a29cfe7610417276c72223af07c199b1..bc9c42c0fa953227878b6708a0fe8f288575032b 100644 (file)
@@ -104,7 +104,7 @@ public class CeTaskInputDaoTest {
 
     underTest.deleteByUuids(dbTester.getSession(), singleton(A_UUID));
     dbTester.commit();
-    assertThat(dbTester.countRowsOfTable(TABLE_NAME)).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable(TABLE_NAME)).isZero();
   }
 
   private void insertData(String uuid) {
index 42a5b7efb0135741f415486dd93a41812504f315..e521615ef5e35fff7f5d17ce0d90758de013192b 100644 (file)
@@ -560,7 +560,7 @@ public class BranchDaoTest {
 
   @Test
   public void countByTypeAndCreationDate() {
-    assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, 0L)).isEqualTo(0);
+    assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, 0L)).isZero();
 
     ComponentDto project = db.components().insertPrivateProject();
     ComponentDto branch1 = db.components().insertProjectBranch(project, b -> b.setBranchType(BranchType.BRANCH));
@@ -568,10 +568,10 @@ public class BranchDaoTest {
     ComponentDto pr = db.components().insertProjectBranch(project, b -> b.setBranchType(BranchType.PULL_REQUEST));
     assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, 0L)).isEqualTo(3);
     assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, NOW)).isEqualTo(3);
-    assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, NOW + 100)).isEqualTo(0);
+    assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.BRANCH, NOW + 100)).isZero();
     assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, 0L)).isEqualTo(1);
     assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, NOW)).isEqualTo(1);
-    assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, NOW + 100)).isEqualTo(0);
+    assertThat(underTest.countByTypeAndCreationDate(dbSession, BranchType.PULL_REQUEST, NOW + 100)).isZero();
   }
 
   @Test
index 7f1c2e7b403eea01e21c443efcd559555320e77d..d7a054284680a79adda8738c6979bac171b6efd9 100644 (file)
@@ -1159,7 +1159,7 @@ public class ComponentDaoTest {
     Supplier<ComponentQuery.Builder> query = () -> ComponentQuery.builder().setOnProvisionedOnly(true);
 
     assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(PROJECT).build())).isEqualTo(1);
-    assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(Qualifiers.VIEW).build())).isEqualTo(0);
+    assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(Qualifiers.VIEW).build())).isZero();
     assertThat(underTest.countByQuery(dbSession, organization.getUuid(), query.get().setQualifiers(PROJECT, Qualifiers.VIEW).build())).isEqualTo(1);
   }
 
@@ -1470,7 +1470,7 @@ public class ComponentDaoTest {
     assertThat(underTest.countByQuery(dbSession, organization2.getUuid(), ALL_PROJECTS_COMPONENT_QUERY))
       .isEqualTo(1);
     assertThat(underTest.countByQuery(dbSession, "non existent organization uuid", ALL_PROJECTS_COMPONENT_QUERY))
-      .isEqualTo(0);
+      .isZero();
   }
 
   @Test
@@ -1628,7 +1628,7 @@ public class ComponentDaoTest {
     int count = underTest.countByQuery(dbSession, dbQuery);
 
     assertThat(result).isEmpty();
-    assertThat(count).isEqualTo(0);
+    assertThat(count).isZero();
   }
 
   @Test
@@ -1656,7 +1656,7 @@ public class ComponentDaoTest {
     int count = underTest.countByQuery(dbSession, dbQuery);
 
     assertThat(result).isEmpty();
-    assertThat(count).isEqualTo(0);
+    assertThat(count).isZero();
   }
 
   @Test
index 6d62edf795dec825c7d5468eb5b5d356a40a1475..2615c9e77565d3d4504643006f0ed6a98d9f7676 100644 (file)
@@ -160,7 +160,7 @@ public class ProjectLinkDaoTest {
     underTest.delete(db.getSession(), link.getUuid());
     db.getSession().commit();
 
-    assertThat(db.countRowsOfTable("project_links")).isEqualTo(0);
+    assertThat(db.countRowsOfTable("project_links")).isZero();
   }
 
 }
index e938671731da3b8dba28842a5328918d56604cc4..e92978a03a286ee8d2cb1edfbb802534b6624cbe 100644 (file)
@@ -139,9 +139,9 @@ public class DuplicationDaoTest {
     Assertions.assertThat(block.getComponentUuid()).isEqualTo(project3.uuid());
     Assertions.assertThat(block.getHash()).isEqualTo("bb");
     Assertions.assertThat(block.getAnalysisUuid()).isEqualTo(analysis3.getUuid());
-    Assertions.assertThat(block.getIndexInFile()).isEqualTo(0);
-    Assertions.assertThat(block.getStartLine()).isEqualTo(0);
-    Assertions.assertThat(block.getEndLine()).isEqualTo(0);
+    Assertions.assertThat(block.getIndexInFile()).isZero();
+    Assertions.assertThat(block.getStartLine()).isZero();
+    Assertions.assertThat(block.getEndLine()).isZero();
   }
 
   @Test
index 583ea35c1b71a6ec84f6d35026106f1ac4eb276d..3388967b9ff15f9d96df39c56e3d141e8d59e72a 100644 (file)
@@ -81,7 +81,7 @@ public class EsQueueDaoTest {
 
     underTest.delete(dbSession, esQueueDtos);
 
-    assertThat(dbTester.countSql(dbSession, "select count(*) from es_queue")).isEqualTo(0);
+    assertThat(dbTester.countSql(dbSession, "select count(*) from es_queue")).isZero();
   }
 
   @Test
@@ -115,7 +115,7 @@ public class EsQueueDaoTest {
     system2.setNow(1_002L);
     EsQueueDto i3 = underTest.insert(dbSession, EsQueueDto.create("foo", UuidFactoryFast.getInstance().create()));
 
-    assertThat(underTest.selectForRecovery(dbSession, 999, LIMIT)).hasSize(0);
+    assertThat(underTest.selectForRecovery(dbSession, 999, LIMIT)).isEmpty();
     assertThat(underTest.selectForRecovery(dbSession, 1_000, LIMIT))
       .extracting(EsQueueDto::getUuid)
       .containsExactly(i1.getUuid());
index e536b4b21287c696401717ff01016cb0457fb711..75856b03d47a1447a953b12dc8d35f5499499db7 100644 (file)
@@ -214,7 +214,7 @@ public class EventDaoTest {
     underTest.delete(dbTester.getSession(), "E1");
     dbTester.commit();
 
-    assertThat(dbTester.countRowsOfTable("events")).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable("events")).isZero();
   }
 
 }
index 6813a473440d3d03b365ea929052cfb008149dc1..554078dce24e86d99a57851a0d3fe93d130ced95 100644 (file)
@@ -269,31 +269,31 @@ public class IssueDaoTest {
     assertThat(result.stream().mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3);
 
     assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.BUG.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3);
-    assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.CODE_SMELL.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
-    assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.VULNERABILITY.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
+    assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.CODE_SMELL.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isZero();
+    assertThat(result.stream().filter(g -> g.getRuleType() == RuleType.VULNERABILITY.getDbConstant()).mapToLong(IssueGroupDto::getCount).sum()).isZero();
 
     assertThat(result.stream().filter(g -> g.getSeverity().equals("CRITICAL")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(2);
     assertThat(result.stream().filter(g -> g.getSeverity().equals("MAJOR")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(1);
-    assertThat(result.stream().filter(g -> g.getSeverity().equals("MINOR")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
+    assertThat(result.stream().filter(g -> g.getSeverity().equals("MINOR")).mapToLong(IssueGroupDto::getCount).sum()).isZero();
 
     assertThat(result.stream().filter(g -> g.getStatus().equals("OPEN")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(2);
     assertThat(result.stream().filter(g -> g.getStatus().equals("RESOLVED")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(1);
-    assertThat(result.stream().filter(g -> g.getStatus().equals("CLOSED")).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
+    assertThat(result.stream().filter(g -> g.getStatus().equals("CLOSED")).mapToLong(IssueGroupDto::getCount).sum()).isZero();
 
     assertThat(result.stream().filter(g -> "FALSE-POSITIVE".equals(g.getResolution())).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(1);
     assertThat(result.stream().filter(g -> g.getResolution() == null).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(2);
 
     assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3);
-    assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
+    assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isZero();
 
     // test leak
     result = underTest.selectIssueGroupsByBaseComponent(db.getSession(), file, 999_999_999L);
-    assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
+    assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isZero();
     assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3);
 
     // test leak using exact creation time of criticalBug2 issue
     result = underTest.selectIssueGroupsByBaseComponent(db.getSession(), file, criticalBug2.getIssueCreationTime());
-    assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(0);
+    assertThat(result.stream().filter(g -> g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isZero();
     assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(IssueGroupDto::getCount).sum()).isEqualTo(3);
   }
 
index b69e6327341c830a99a438c436a301e09e3b264d..3660905b3b2c81ba811ff563134efc7b959edff6 100644 (file)
@@ -224,7 +224,7 @@ public class IssueMapperTest {
     dto.setSelectedAt(1400000000000L);
 
     int count = underTest.updateIfBeforeSelectedDate(dto);
-    assertThat(count).isEqualTo(0);
+    assertThat(count).isZero();
     dbTester.getSession().commit();
 
     // No change
index 004a7fc1f94243e8f8530a6a855cc9089e6d8451..489b83e4313114ff2fc8e569881e6882d6307d90 100644 (file)
@@ -498,7 +498,7 @@ public class LiveMeasureDaoTest {
 
     // update
     int count = underTest.upsert(db.getSession(), dto);
-    assertThat(count).isEqualTo(0);
+    assertThat(count).isZero();
     verifyPersisted(dto);
     verifyTableSize(1);
   }
@@ -530,7 +530,7 @@ public class LiveMeasureDaoTest {
 
     // update
     int count = underTest.upsert(db.getSession(), dto);
-    assertThat(count).isEqualTo(0);
+    assertThat(count).isZero();
     verifyPersisted(dto);
     verifyTableSize(1);
   }
index 97043ee749103c254dc8651e0cb7582dde50f27d..25169daeeda3a804683d4fb5160146163b3206bd 100644 (file)
@@ -59,7 +59,7 @@ public class NotificationQueueDaoTest {
   public void should_count_notification_queue() {
     NotificationQueueDto notificationQueueDto = toNotificationQueueDto(new Notification("email"));
 
-    assertThat(dao.count()).isEqualTo(0);
+    assertThat(dao.count()).isZero();
 
     dao.insert(Arrays.asList(notificationQueueDto));
 
index c10fb8533d186420c83fc65f40c17293c4ae9c40..3f602c4a785c1fcaec1f3358114988cd4abb0bdd 100644 (file)
@@ -565,7 +565,7 @@ public class GroupPermissionDaoTest {
     underTest.deleteByRootComponentUuid(dbSession, project1.uuid());
     dbSession.commit();
 
-    assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isEqualTo(0);
+    assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isZero();
     assertThat(db.countRowsOfTable("group_roles")).isEqualTo(2);
   }
 
@@ -584,7 +584,7 @@ public class GroupPermissionDaoTest {
     underTest.deleteByRootComponentUuid(dbSession, project1.uuid());
     dbSession.commit();
 
-    assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isEqualTo(0);
+    assertThat(db.countSql("select count(uuid) from group_roles where component_uuid='" + project1.uuid() + "'")).isZero();
     assertThat(db.countRowsOfTable("group_roles")).isEqualTo(3);
   }
 
@@ -770,8 +770,8 @@ public class GroupPermissionDaoTest {
   public void deleteByRootComponentUuidAndGroupUuid_has_no_effect_if_component_does_not_exist() {
     GroupDto group = db.users().insertGroup();
 
-    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", null)).isEqualTo(0);
-    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", group.getUuid())).isEqualTo(0);
+    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", null)).isZero();
+    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, "1234", group.getUuid())).isZero();
   }
 
   @Test
@@ -779,15 +779,15 @@ public class GroupPermissionDaoTest {
     ComponentDto project = randomPublicOrPrivateProject();
     GroupDto group = db.users().insertGroup();
 
-    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), null)).isEqualTo(0);
-    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), group.getUuid())).isEqualTo(0);
+    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), null)).isZero();
+    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), group.getUuid())).isZero();
   }
 
   @Test
   public void deleteByRootComponentUuidAndGroupUuid_has_no_effect_if_group_does_not_exist() {
     ComponentDto project = randomPublicOrPrivateProject();
 
-    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), "5678")).isEqualTo(0);
+    assertThat(underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), "5678")).isZero();
   }
 
   @Test
@@ -804,7 +804,7 @@ public class GroupPermissionDaoTest {
 
     int deletedCount = underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), null);
 
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, null, project.uuid()))
       .isEmpty();
     assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, group1.getUuid(), project.uuid()))
@@ -826,7 +826,7 @@ public class GroupPermissionDaoTest {
 
     int deletedCount = underTest.deleteByRootComponentUuidAndGroupUuid(dbSession, project.uuid(), group2.getUuid());
 
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, group1.getUuid(), project.uuid()))
       .containsOnly("p1");
     assertThat(underTest.selectProjectPermissionsOfGroup(dbSession, group2.getUuid(), project.uuid()))
@@ -876,7 +876,7 @@ public class GroupPermissionDaoTest {
     db.users().insertPermissionOnAnyone("p1");
     db.users().insertPermissionOnGroup(group, "p1");
 
-    assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isEqualTo(0);
+    assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isZero();
 
     assertThat(getGlobalPermissionsForAnyone()).containsOnly("p1");
     assertThat(getGlobalPermissionsForGroup(group)).containsOnly("p1");
@@ -893,7 +893,7 @@ public class GroupPermissionDaoTest {
     db.users().insertProjectPermissionOnGroup(group, "p1", project);
     db.users().insertProjectPermissionOnAnyone("p1", project);
 
-    assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, "1324", "p1")).isEqualTo(0);
+    assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, "1324", "p1")).isZero();
 
     assertThat(getGlobalPermissionsForAnyone()).containsOnly("p1");
     assertThat(getGlobalPermissionsForGroup(group)).containsOnly("p1");
@@ -908,7 +908,7 @@ public class GroupPermissionDaoTest {
     db.users().insertPermissionOnAnyone("p1");
     db.users().insertPermissionOnGroup(group, "p1");
 
-    assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isEqualTo(0);
+    assertThat(underTest.deleteByRootComponentUuidAndPermission(dbSession, project.uuid(), "p1")).isZero();
   }
 
   private Collection<String> getGlobalPermissionsForAnyone() {
@@ -945,7 +945,7 @@ public class GroupPermissionDaoTest {
   }
 
   private void assertThatNoPermission(String permission) {
-    assertThat(db.countSql("select count(uuid) from group_roles where role='" + permission + "'")).isEqualTo(0);
+    assertThat(db.countSql("select count(uuid) from group_roles where role='" + permission + "'")).isZero();
   }
 
 }
index 0b200fe912b28f43433369708f39751bfed97a51..1fbce9a9e9a3a9fc734ff2d523cfa0e10b0d5eb8 100644 (file)
@@ -65,7 +65,7 @@ public class PermissionQueryTest {
     PermissionQuery query = PermissionQuery.builder()
       .build();
 
-    assertThat(query.getPageOffset()).isEqualTo(0);
+    assertThat(query.getPageOffset()).isZero();
     assertThat(query.getPageSize()).isEqualTo(20);
   }
 
index b27de1c0ad71b64f51b63206637e8c32ee0c95ca..253dbbd4de2a8bc2ac60f7e2cc62ac6b2c8f2b35 100644 (file)
@@ -381,7 +381,7 @@ public class UserPermissionDaoTest {
 
     // global permission exists -> delete it, but not the project permission with the same name !
     underTest.deleteGlobalPermission(dbSession, user1.getUuid(), "perm1");
-    assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where role='perm1' and component_uuid is null")).isEqualTo(0);
+    assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where role='perm1' and component_uuid is null")).isZero();
     assertThat(db.countRowsOfTable(dbSession, "user_roles")).isEqualTo(4);
   }
 
@@ -523,7 +523,7 @@ public class UserPermissionDaoTest {
 
     int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, "124", SCAN.getKey());
 
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey());
   }
 
@@ -535,7 +535,7 @@ public class UserPermissionDaoTest {
 
     int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, project.uuid(), SCAN.getKey());
 
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey());
   }
 
@@ -548,7 +548,7 @@ public class UserPermissionDaoTest {
 
     int deletedCount = underTest.deleteProjectPermissionOfAnyUser(dbSession, project.uuid(), "p1");
 
-    assertThat(deletedCount).isEqualTo(0);
+    assertThat(deletedCount).isZero();
     assertThat(underTest.selectGlobalPermissionsOfUser(dbSession, user.getUuid())).containsOnly(SCAN.getKey());
     assertThat(underTest.selectProjectPermissionsOfUser(dbSession, user.getUuid(), project.uuid())).containsOnly(SCAN.getKey());
   }
@@ -647,11 +647,11 @@ public class UserPermissionDaoTest {
   private void assertThatProjectPermissionDoesNotExist(UserDto user, String permission, ComponentDto project) {
     assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where role='" + permission + "' and user_uuid='" + user.getUuid()
       + "' and component_uuid='" + project.uuid() + "'"))
-      .isEqualTo(0);
+      .isZero();
   }
 
   private void assertThatProjectHasNoPermissions(ComponentDto project) {
-    assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where component_uuid='" + project.uuid() + "'")).isEqualTo(0);
+    assertThat(db.countSql(dbSession, "select count(uuid) from user_roles where component_uuid='" + project.uuid() + "'")).isZero();
   }
 
   private void assertGlobalPermissionsOfUser(UserDto user, GlobalPermission... permissions) {
index 1277cc03065320455a08f569926a29d0f887b39e..0d451498d13e4a962b7531293ec15469d6ad9e0a 100644 (file)
@@ -172,7 +172,7 @@ public class ProjectDaoTest {
     projectDao.insert(db.getSession(), dto3);
 
     List<ProjectDto> projectsByUuids = projectDao.selectByUuids(db.getSession(), Collections.emptySet());
-    assertThat(projectsByUuids).hasSize(0);
+    assertThat(projectsByUuids).isEmpty();
   }
 
   private void assertProject(ProjectDto dto, String name, String kee, String org, String uuid, String desc, @Nullable String tags, boolean isPrivate) {
index ea01da4cdf12b5ce5f6820d99c508725188eec75..366f3cd81472ae0f83e5d4f030f2d557267b63db 100644 (file)
@@ -165,7 +165,7 @@ public class InternalComponentPropertiesDaoTest {
   public void delete_by_component_uuid_and_key_does_nothing_if_property_doesnt_exist() {
     saveDto();
 
-    assertThat(underTest.deleteByComponentUuid(dbSession, "other_component")).isEqualTo(0);
+    assertThat(underTest.deleteByComponentUuid(dbSession, "other_component")).isZero();
     assertThat(underTest.selectByComponentUuidAndKey(dbSession, SOME_COMPONENT, SOME_KEY)).isNotEmpty();
   }
 
index 1c94f954b0c420ceb967da5d098ef28cf990ec2f..80810c1917b04da6dce7e7cfe6559f37306d6299 100644 (file)
@@ -248,10 +248,10 @@ public class PurgeDaoTest {
     IssueDto openOnEnabledComponent = db.issues().insert(rule, project, enabledFile, issue -> issue.setStatus("OPEN"));
     IssueDto confirmOnEnabledComponent = db.issues().insert(rule, project, enabledFile, issue -> issue.setStatus("CONFIRM"));
 
-    assertThat(db.countSql("select count(*) from snapshots where purge_status = 1")).isEqualTo(0);
+    assertThat(db.countSql("select count(*) from snapshots where purge_status = 1")).isZero();
 
-    assertThat(db.countSql("select count(*) from issues where status = 'CLOSED'")).isEqualTo(0);
-    assertThat(db.countSql("select count(*) from issues where resolution = 'REMOVED'")).isEqualTo(0);
+    assertThat(db.countSql("select count(*) from issues where status = 'CLOSED'")).isZero();
+    assertThat(db.countSql("select count(*) from issues where resolution = 'REMOVED'")).isZero();
 
     db.fileSources().insertFileSource(srcFile);
     FileSourceDto nonSelectedFileSource = db.fileSources().insertFileSource(enabledFile);
@@ -826,7 +826,7 @@ public class PurgeDaoTest {
     dbSession.commit();
 
     assertThat(db.countRowsOfTable("ce_queue")).isEqualTo(1);
-    assertThat(db.countSql("select count(*) from ce_queue where main_component_uuid='" + projectToBeDeleted.uuid() + "'")).isEqualTo(0);
+    assertThat(db.countSql("select count(*) from ce_queue where main_component_uuid='" + projectToBeDeleted.uuid() + "'")).isZero();
   }
 
   @Test
@@ -1160,7 +1160,7 @@ public class PurgeDaoTest {
 
     assertThat(selectActivity("VERY_OLD_1")).isEmpty();
     assertThat(selectTaskInput("VERY_OLD_1")).isEmpty();
-    assertThat(selectTaskCharacteristic("VERY_OLD_1")).hasSize(0);
+    assertThat(selectTaskCharacteristic("VERY_OLD_1")).isEmpty();
     assertThat(scannerContextExists("VERY_OLD_1")).isFalse();
     assertThat(selectActivity("VERY_OLD_2")).isNotEmpty();
     assertThat(selectTaskInput("VERY_OLD_2")).isNotEmpty();
@@ -1169,7 +1169,7 @@ public class PurgeDaoTest {
 
     assertThat(selectActivity("JUST_OLD_ENOUGH_1")).isEmpty();
     assertThat(selectTaskInput("JUST_OLD_ENOUGH_1")).isEmpty();
-    assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).hasSize(0);
+    assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).isEmpty();
     assertThat(scannerContextExists("JUST_OLD_ENOUGH_1")).isFalse();
     assertThat(selectActivity("JUST_OLD_ENOUGH_2")).isNotEmpty();
     assertThat(selectTaskInput("JUST_OLD_ENOUGH_2")).isNotEmpty();
@@ -1218,7 +1218,7 @@ public class PurgeDaoTest {
 
     assertThat(selectActivity("VERY_OLD_1")).isEmpty();
     assertThat(selectTaskInput("VERY_OLD_1")).isEmpty();
-    assertThat(selectTaskCharacteristic("VERY_OLD_1")).hasSize(0);
+    assertThat(selectTaskCharacteristic("VERY_OLD_1")).isEmpty();
     assertThat(scannerContextExists("VERY_OLD_1")).isFalse();
     assertThat(selectActivity("VERY_OLD_2")).isEmpty();
     assertThat(selectTaskInput("VERY_OLD_2")).isEmpty();
@@ -1227,7 +1227,7 @@ public class PurgeDaoTest {
 
     assertThat(selectActivity("JUST_OLD_ENOUGH_1")).isEmpty();
     assertThat(selectTaskInput("JUST_OLD_ENOUGH_1")).isEmpty();
-    assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).hasSize(0);
+    assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH_1")).isEmpty();
     assertThat(scannerContextExists("JUST_OLD_ENOUGH_1")).isFalse();
     assertThat(selectActivity("JUST_OLD_ENOUGH_2")).isEmpty();
     assertThat(selectTaskInput("JUST_OLD_ENOUGH_2")).isEmpty();
@@ -1561,12 +1561,12 @@ public class PurgeDaoTest {
 
     assertThat(selectActivity("VERY_OLD")).isEmpty();
     assertThat(selectTaskInput("VERY_OLD")).isEmpty();
-    assertThat(selectTaskCharacteristic("VERY_OLD")).hasSize(0);
+    assertThat(selectTaskCharacteristic("VERY_OLD")).isEmpty();
     assertThat(scannerContextExists("VERY_OLD")).isFalse();
 
     assertThat(selectActivity("JUST_OLD_ENOUGH")).isEmpty();
     assertThat(selectTaskInput("JUST_OLD_ENOUGH")).isEmpty();
-    assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH")).hasSize(0);
+    assertThat(selectTaskCharacteristic("JUST_OLD_ENOUGH")).isEmpty();
     assertThat(scannerContextExists("JUST_OLD_ENOUGH")).isFalse();
 
     assertThat(selectActivity("NOT_OLD_ENOUGH")).isNotEmpty();
index 20ce6764f80343604e81c93f57f30c15028e0d27..5a81dd9421fae9c3f9053bc94c74fd10eb3e19f7 100644 (file)
@@ -526,7 +526,7 @@ public class ActiveRuleDaoTest {
 
     underTest.deleteParam(dbSession, param);
 
-    assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, activeRule.getUuid())).hasSize(0);
+    assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, activeRule.getUuid())).isEmpty();
   }
 
   @Test
@@ -593,7 +593,7 @@ public class ActiveRuleDaoTest {
 
     underTest.deleteParamsByActiveRuleUuids(dbSession, singletonList(ar1.getUuid()));
 
-    assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, ar1.getUuid())).hasSize(0);
+    assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, ar1.getUuid())).isEmpty();
     assertThat(underTest.selectParamsByActiveRuleUuid(dbSession, ar2.getUuid())).hasSize(1);
   }
 
index 18c9815f66ceef39abc2bce22d70a6cc80775f75..f6f2d0c4451bf47a84ac796c9f9261c4a9f43802 100644 (file)
@@ -198,11 +198,11 @@ public class QProfileChangeDaoTest {
 
     assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile1.getKee()))).isEqualTo(2);
     assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile2.getKee()))).isEqualTo(1);
-    assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery("does_not_exist"))).isEqualTo(0);
+    assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery("does_not_exist"))).isZero();
 
     QProfileChangeQuery query = new QProfileChangeQuery(profile1.getKee());
     query.setToExcluded(start);
-    assertThat(underTest.countByQuery(dbSession, query)).isEqualTo(0);
+    assertThat(underTest.countByQuery(dbSession, query)).isZero();
 
     QProfileChangeQuery query2 = new QProfileChangeQuery(profile1.getKee());
     query2.setToExcluded(end);
@@ -219,7 +219,7 @@ public class QProfileChangeDaoTest {
 
     underTest.deleteByRulesProfileUuids(dbSession, asList(profile1.getRulesProfileUuid()));
 
-    assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile1.getKee()))).isEqualTo(0);
+    assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile1.getKee()))).isZero();
     assertThat(underTest.countByQuery(dbSession, new QProfileChangeQuery(profile2.getKee()))).isEqualTo(1);
   }
 
index 0f45bb7f4dbb222f50f0076c8e0e91843b717054..c4b78983b83eb8ec8f9f08b31e790d27cf52df00 100644 (file)
@@ -448,7 +448,7 @@ public class RuleDaoTest {
     assertThat(ruleDto.getRuleKey()).isEqualTo("NewRuleKey");
     assertThat(ruleDto.getRepositoryKey()).isEqualTo("plugin");
     assertThat(ruleDto.getConfigKey()).isEqualTo("NewConfigKey");
-    assertThat(ruleDto.getSeverity()).isEqualTo(0);
+    assertThat(ruleDto.getSeverity()).isZero();
     assertThat(ruleDto.getLanguage()).isEqualTo("dart");
     assertThat(ruleDto.isTemplate()).isTrue();
     assertThat(ruleDto.isExternal()).isTrue();
@@ -505,7 +505,7 @@ public class RuleDaoTest {
     assertThat(ruleDto.getRuleKey()).isEqualTo("NewRuleKey");
     assertThat(ruleDto.getRepositoryKey()).isEqualTo("plugin");
     assertThat(ruleDto.getConfigKey()).isEqualTo("NewConfigKey");
-    assertThat(ruleDto.getSeverity()).isEqualTo(0);
+    assertThat(ruleDto.getSeverity()).isZero();
     assertThat(ruleDto.getLanguage()).isEqualTo("dart");
     assertThat(ruleDto.isTemplate()).isTrue();
     assertThat(ruleDto.isExternal()).isTrue();
index b047b2c3481eacf15785b360d2d012704a704ef2..d348092715e5440fa4ad37491dd4f1ad8495f74b 100644 (file)
@@ -141,7 +141,7 @@ public class RuleRepositoryDaoTest {
     RuleRepositoryDto dto1 = new RuleRepositoryDto("findbugs", "java", "Findbugs");
     underTest.insertOrUpdate(dbSession, asList(dto1));
 
-    assertThat(underTest.selectByLanguage(dbSession, "missing")).hasSize(0);
+    assertThat(underTest.selectByLanguage(dbSession, "missing")).isEmpty();
   }
 
   private long selectCreatedAtByKey(DbSession dbSession, String key) {
index 0acd744155687cbe18e623e9549877a5cdd9d78d..25052001869805798bb446aaa6681f6fa3c8cff1 100644 (file)
@@ -163,7 +163,7 @@ public class FileSourceDaoTest {
 
     FileSourceDto res = underTest.selectByFileUuid(dbSession, fileSourceDto.getFileUuid());
 
-    assertThat(res.getLineCount()).isEqualTo(0);
+    assertThat(res.getLineCount()).isZero();
     assertThat(res.getLineHashes()).isEmpty();
   }
 
index 671922b5e83a6d4008c951a103abb102f9632941..5f4ce8a4e22e4fae4b13508cb4f7e0cfb8e286e3 100644 (file)
@@ -216,6 +216,6 @@ public class GroupDaoTest {
 
     underTest.deleteByUuid(dbSession, aGroup.getUuid());
 
-    assertThat(db.countRowsOfTable(dbSession, "groups")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(dbSession, "groups")).isZero();
   }
 }
index 41989df68b32174c05f2c02d4133e2264cb25d5a..e4fecb88010412c4ed3c9938ba782e9b353dc4a3 100644 (file)
@@ -214,7 +214,7 @@ public class UserDaoTest {
 
   @Test
   public void countRootUsersButLogin_returns_0_when_there_is_no_user_at_all() {
-    assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0);
+    assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero();
   }
 
   @Test
@@ -222,7 +222,7 @@ public class UserDaoTest {
     underTest.insert(session, newUserDto());
     session.commit();
 
-    assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0);
+    assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero();
   }
 
   @Test
@@ -231,7 +231,7 @@ public class UserDaoTest {
     insertInactiveRootUser(newUserDto());
     session.commit();
 
-    assertThat(underTest.countRootUsersButLogin(session, "bla")).isEqualTo(0);
+    assertThat(underTest.countRootUsersButLogin(session, "bla")).isZero();
   }
 
   @Test
index c6b67a5dd2ee8dfb4c0e5ccde7ec0c8f086c3478..96c999c6c8738b8bf0687bdef431f91db223ca26 100644 (file)
@@ -225,7 +225,7 @@ public class WebhookDeliveryDaoTest {
   public void deleteComponentBeforeDate_does_nothing_on_empty_table() {
     underTest.deleteComponentBeforeDate(dbSession, "COMPONENT_1", 1_500_000L);
 
-    assertThat(dbTester.countRowsOfTable(dbSession, "webhook_deliveries")).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable(dbSession, "webhook_deliveries")).isZero();
   }
 
   @Test
index b34233ddef25c46e55fae1f4ff3d16de538bc6bd..e55d53fa1e56463d420d1c4f9da3b26bcf35a1a8 100644 (file)
@@ -48,7 +48,7 @@ public class MigrationContainerImplTest {
 
   @Test
   public void migration_container_lazily_instance_components() {
-    assertThat(StartCallCounter.startCalls).isEqualTo(0);
+    assertThat(StartCallCounter.startCalls).isZero();
 
     StartCallCounter startCallCounter = underTest.getComponentByType(StartCallCounter.class);
 
index 5e7583788af02e94d2a42441f2c5d091d56955bf..2dbf7a765dbdb71a7d0bacb6b1cb3da68562a81d 100644 (file)
@@ -68,7 +68,7 @@ public class MigrationHistoryTableImplTest {
   }
 
   private void verifyTable() {
-    assertThat(dbTester.countRowsOfTable(TABLE_SCHEMA_MIGRATIONS)).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable(TABLE_SCHEMA_MIGRATIONS)).isZero();
     dbTester.assertColumnDefinition(TABLE_SCHEMA_MIGRATIONS, "version", Types.VARCHAR, 255, false);
   }
 }
index 9066de0f911e9d9d14f0d3fc151939e2ad83f89a..43e5c5ffea5f6a5896089b9d3c8aafe6ac63ce5d 100644 (file)
@@ -48,7 +48,7 @@ public class UpsertImplTest {
 
     underTest.setBatchSize(0);
 
-    assertThat(underTest.getMaxBatchSize()).isEqualTo(0);
+    assertThat(underTest.getMaxBatchSize()).isZero();
   }
 
   @Test
index d02519e4d1b65a3ea4196aa8e1fd67ba02426efe..8e4df77962a8dd5769f0c8592db0fc2331e62e25 100644 (file)
@@ -74,7 +74,7 @@ public class PopulateNewCodePeriodTableTest {
     insertProperty(0, "2019-04-05");
 
     underTest.execute();
-    assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isZero();
   }
 
   @Test
@@ -82,7 +82,7 @@ public class PopulateNewCodePeriodTableTest {
     insertProperty(null, "2.0");
 
     underTest.execute();
-    assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(0);
+    assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isZero();
   }
 
   @Test
index 0049edf67e58ed7f8a062f9cb47c2da9b7c81cb2..43795e4ca5bbe020ef7740d7146fb4ef544d67be 100644 (file)
@@ -75,7 +75,7 @@ public class AddExcludeBranchFromPurgeColumnTest {
   }
 
   private void verifyMigrationResult() {
-    assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = true")).isEqualTo(0);
+    assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = true")).isZero();
     assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = false")).isEqualTo(8);
   }
 
index 57e4e507fbbeb45aca95d19e447c53001ee51d9d..b9e963d688ec245653d3992c15594b3a7a7a1ecb 100644 (file)
@@ -126,7 +126,7 @@ public class MigrateDefaultBranchesToKeepSettingTest {
 
   private void verifyMigrationOfDefaultSetting(String expectedValue) {
     assertThat(dbTester.countRowsOfTable(PROPS_TABLE)).isEqualTo(4);
-    assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.branch.longLivedBranches.regex'")).isEqualTo(0);
+    assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.branch.longLivedBranches.regex'")).isZero();
     assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'")).isEqualTo(1);
     assertThat(dbTester.select("select resource_id, text_value from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'")
       .stream()
index 8d2854281e314b576e692c1468ac5615e8e9e904..81f3c41e257bca8646c1f1c5e628fdab9bb58abf 100644 (file)
@@ -73,7 +73,7 @@ public class MigrateSlbsAndLlbsToCommonTypeInCeTasksTest {
 
   private void verifyMigrationResult() {
     assertThat(dbTester.countRowsOfTable(TABLE)).isEqualTo(8);
-    assertThat(dbTester.countSql("select count(*) from " + TABLE + " where kee = 'branchType' and text_value in ('LONG', 'SHORT')")).isEqualTo(0);
+    assertThat(dbTester.countSql("select count(*) from " + TABLE + " where kee = 'branchType' and text_value in ('LONG', 'SHORT')")).isZero();
     assertThat(dbTester.select("select uuid from " + TABLE + " where kee = 'branchType' and text_value = 'BRANCH'")
       .stream()
       .map(e -> e.get("UUID"))
index 1cd8545c4c8f85779dc3ee4dc469771ef06a14bb..1deba5caecadd4b4505e0ee33fb03f37680be8fb 100644 (file)
@@ -80,7 +80,7 @@ public class MigrateSlbsAndLlbsToCommonTypeTest {
 
   private void verifyMigrationResult() {
     assertThat(dbTester.countRowsOfTable(BRANCHES_TABLE)).isEqualTo(8);
-    assertThat(dbTester.countSql("select count(*) from project_branches where branch_type = 'LONG' or branch_type = 'SHORT'")).isEqualTo(0);
+    assertThat(dbTester.countSql("select count(*) from project_branches where branch_type = 'LONG' or branch_type = 'SHORT'")).isZero();
     assertThat(dbTester.select("select uuid from " + BRANCHES_TABLE + " where branch_type = 'BRANCH'")
       .stream()
       .map(e -> e.get("UUID"))
index 4d84868b83b33dba9a71ebca0dcdf2d17cd7118c..0a36571bb9d31f7db8adce39202cc3f5f5ca4119 100644 (file)
@@ -82,7 +82,7 @@ public class RenameDaysBeforeDeletingInactiveSLBSettingTest {
     int numberOfPropsWithNewName = dbTester.countSql("select count(*) from " + TABLE + " where prop_key = '" + NEW_PROPERTY_NAME + "'");
     int numberOfPropsWithOldName = dbTester.countSql("select count(*) from " + TABLE + " where prop_key = '" + OLD_PROPERTY_NAME + "'");
     assertThat(numberOfPropsWithNewName).isEqualTo(TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES + 1);
-    assertThat(numberOfPropsWithOldName).isEqualTo(0);
+    assertThat(numberOfPropsWithOldName).isZero();
   }
 
   private void insertProperty(@Nullable Long projectId, String propertyKey, String propertyValue) {
index c753636a2292f2435590efb0321d9de0edcf7675..27a0c5a704ce4ba5be4687ec33e60db783511b5d 100644 (file)
@@ -55,7 +55,7 @@ public class EnsureHotspotDefaultStatusIsToReviewTest {
   public void does_not_fail_if_table_is_empty() throws SQLException {
     underTest.execute();
 
-    assertThat(db.countRowsOfTable("issues")).isEqualTo(0);
+    assertThat(db.countRowsOfTable("issues")).isZero();
   }
 
   @Test
index c78627d1c781c1140c07df07d23b43654668aadc..7e6a9e2ee9b6cef6294e40f68e2b87e4de6553cd 100644 (file)
@@ -104,7 +104,7 @@ public class EsLoggingTest {
   }
 
   private static Props newProps(String... propertyKeysAndValues) {
-    assertThat(propertyKeysAndValues.length % 2).describedAs("Number of parameters must be even").isEqualTo(0);
+    assertThat(propertyKeysAndValues.length % 2).describedAs("Number of parameters must be even").isZero();
     Properties properties = new Properties();
     for (int i = 0; i < propertyKeysAndValues.length; i++) {
       properties.put(propertyKeysAndValues[i++], propertyKeysAndValues[i]);
@@ -114,9 +114,9 @@ public class EsLoggingTest {
 
   private void verifyProperties(Properties properties, String... expectedPropertyKeysAndValuesOrdered) {
     if (expectedPropertyKeysAndValuesOrdered.length == 0) {
-      assertThat(properties.size()).isEqualTo(0);
+      assertThat(properties.size()).isZero();
     } else {
-      assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isEqualTo(0);
+      assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isZero();
       Set<String> keys = new HashSet<>(expectedPropertyKeysAndValuesOrdered.length / 2 + 1);
       keys.add("status");
       for (int i = 0; i < expectedPropertyKeysAndValuesOrdered.length; i++) {
index 1a70413b89bfa1a265be2c4c2d99f898aedfb0ad..dc4a362796b1b6f0964de5693cd8cfdbcdbd97cf 100644 (file)
@@ -268,7 +268,7 @@ public class FileUtils2Test {
   public void sizeOf_is_zero_on_empty_files() throws IOException {
     File file = temporaryFolder.newFile();
 
-    assertThat(FileUtils2.sizeOf(file.toPath())).isEqualTo(0);
+    assertThat(FileUtils2.sizeOf(file.toPath())).isZero();
   }
 
   @Test
index c944cb2e583bb78d1c7b7d2e91590e7d8be4238a..e98fdbfba6fef793e3144a64d6fe46286e9cb1a7 100644 (file)
@@ -482,7 +482,7 @@ public class Log4JPropertiesBuilderTest {
 
   private static Log4JPropertiesBuilder newLog4JPropertiesBuilder(String... propertyKeysAndValues) {
     Properties properties = new Properties();
-    assertThat(propertyKeysAndValues.length % 2).describedAs("propertyKeysAndValues must have even length").isEqualTo(0);
+    assertThat(propertyKeysAndValues.length % 2).describedAs("propertyKeysAndValues must have even length").isZero();
     for (int i = 0; i < propertyKeysAndValues.length; i++) {
       properties.put(propertyKeysAndValues[i++], propertyKeysAndValues[i]);
     }
@@ -534,7 +534,7 @@ public class Log4JPropertiesBuilderTest {
     if (expectedPropertyKeysAndValuesOrdered.length == 0) {
       assertThat(properties.size()).isEqualTo(1);
     } else {
-      assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isEqualTo(0);
+      assertThat(expectedPropertyKeysAndValuesOrdered.length % 2).describedAs("Number of parameters must be even").isZero();
       Set<String> keys = new HashSet<>(expectedPropertyKeysAndValuesOrdered.length / 2 + 1);
       keys.add("status");
       for (int i = 0; i < expectedPropertyKeysAndValuesOrdered.length; i++) {
index a16c33ddeee5e27901679a7aa0605cdae053cb3d..63d5d66b3ee7ae02fa1bac079ae6a6b3ac467073 100644 (file)
@@ -70,7 +70,7 @@ public class LogLevelConfigTest {
     assertThat(underTest.getConfiguredByProperties()).hasSize(1);
     assertThat(underTest.getConfiguredByProperties().get(rootLoggerName))
       .containsExactly("sonar.log.level", "sonar.log.level.es");
-    assertThat(underTest.getConfiguredByHardcodedLevel()).hasSize(0);
+    assertThat(underTest.getConfiguredByHardcodedLevel()).isEmpty();
   }
 
   @Test
@@ -132,7 +132,7 @@ public class LogLevelConfigTest {
     assertThat(underTest.getConfiguredByProperties()).hasSize(1);
     assertThat(underTest.getConfiguredByProperties().get("foo"))
       .containsExactly("sonar.log.level", "sonar.log.level.web", "sonar.log.level.web.sql");
-    assertThat(underTest.getConfiguredByHardcodedLevel()).hasSize(0);
+    assertThat(underTest.getConfiguredByHardcodedLevel()).isEmpty();
   }
 
   @Test
index 3fa05bebd51ec807cb462c3e717d33ba1c07eee0..ec66760a1378f8b4b8deef9ab5fac1a3ed71603e 100644 (file)
@@ -165,7 +165,7 @@ public class LogbackHelperTest {
     julLogger.severe("Message1");
 
     // JUL bridge has not been initialized, nothing in logs
-    assertThat(memoryAppender.getLogs()).hasSize(0);
+    assertThat(memoryAppender.getLogs()).isEmpty();
 
     // Enabling JUL bridge
     LoggerContextListener propagator = underTest.enableJulChangePropagation(ctx);
index 11fe9a7ac0e103516da5e43145801f6b88549874..30073889618fc72641b635aedd51d5039463ecfe 100644 (file)
@@ -228,7 +228,7 @@ public class ComponentIndexerTest {
     result = recover();
     assertThat(result.getTotal()).isEqualTo(1L);
     assertThat(result.getFailures()).isEqualTo(1L);
-    assertThat(es.countDocuments(TYPE_COMPONENT)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_COMPONENT)).isZero();
 
     es.unlockWrites(TYPE_COMPONENT);
 
index 0e0874fd2d9c9a3f67b1d0fa22f93478c6c7758b..8c27c7640fdd053da8eed71d4e3a97e258b0149c 100644 (file)
@@ -31,13 +31,13 @@ public class BulkIndexerConcurrentRequestCalculationTest {
   @Test
   public void should_not_parallelize_if_regular_size() {
     assertConcurrentRequests(BulkIndexer.Size.REGULAR, cores(4))
-      .isEqualTo(0);
+      .isZero();
   }
 
   @Test
   public void should_not_parallelize_if_large_indexing_but_few_cores() {
     assertConcurrentRequests(BulkIndexer.Size.LARGE, cores(4))
-      .isEqualTo(0);
+      .isZero();
   }
 
   /**
index 52a0ef0a73bd66de4660abcff71a1e2b3f060b47..ea6cbc5821ac4405f8d75f7a2f27a306ccfa6ef3 100644 (file)
@@ -62,7 +62,7 @@ public class BulkIndexerTest {
     indexer.start();
     indexer.stop();
 
-    assertThat(count()).isEqualTo(0);
+    assertThat(count()).isZero();
   }
 
   @Test
@@ -73,7 +73,7 @@ public class BulkIndexerTest {
     indexer.add(newIndexRequest(78));
 
     // request is not sent yet
-    assertThat(count()).isEqualTo(0);
+    assertThat(count()).isZero();
 
     // send remaining requests
     indexer.stop();
@@ -89,7 +89,7 @@ public class BulkIndexerTest {
     indexer.start();
 
     // replicas are temporarily disabled
-    assertThat(replicas()).isEqualTo(0);
+    assertThat(replicas()).isZero();
 
     for (int i = 0; i < 10; i++) {
       indexer.add(newIndexRequest(i));
@@ -98,7 +98,7 @@ public class BulkIndexerTest {
 
     assertThat(result.isSuccess()).isTrue();
     assertThat(result.getSuccess()).isEqualTo(10);
-    assertThat(result.getFailures()).isEqualTo(0);
+    assertThat(result.getFailures()).isZero();
     assertThat(result.getTotal()).isEqualTo(10);
     assertThat(count()).isEqualTo(10);
     // replicas are re-enabled
index a9b9a0b7584603e16a790b5b5dc2cae3288273c2..63dd2906739b3aaa864aab5ac726d178baf79255 100644 (file)
@@ -32,9 +32,9 @@ public class IndexingResultTest {
 
   @Test
   public void test_empty() {
-    assertThat(underTest.getFailures()).isEqualTo(0);
-    assertThat(underTest.getSuccess()).isEqualTo(0);
-    assertThat(underTest.getTotal()).isEqualTo(0);
+    assertThat(underTest.getFailures()).isZero();
+    assertThat(underTest.getSuccess()).isZero();
+    assertThat(underTest.getTotal()).isZero();
     assertThat(underTest.getSuccessRatio()).isEqualTo(1.0, DOUBLE_OFFSET);
     assertThat(underTest.isSuccess()).isTrue();
   }
@@ -46,7 +46,7 @@ public class IndexingResultTest {
     underTest.incrementSuccess();
     underTest.incrementSuccess();
 
-    assertThat(underTest.getFailures()).isEqualTo(0);
+    assertThat(underTest.getFailures()).isZero();
     assertThat(underTest.getSuccess()).isEqualTo(2);
     assertThat(underTest.getTotal()).isEqualTo(2);
     assertThat(underTest.getSuccessRatio()).isEqualTo(1.0, DOUBLE_OFFSET);
@@ -59,7 +59,7 @@ public class IndexingResultTest {
     underTest.incrementRequests();
 
     assertThat(underTest.getFailures()).isEqualTo(2);
-    assertThat(underTest.getSuccess()).isEqualTo(0);
+    assertThat(underTest.getSuccess()).isZero();
     assertThat(underTest.getTotal()).isEqualTo(2);
     assertThat(underTest.getSuccessRatio()).isEqualTo(0.0, DOUBLE_OFFSET);
     assertThat(underTest.isSuccess()).isFalse();
@@ -82,9 +82,9 @@ public class IndexingResultTest {
 
   @Test
   public void correctness_even_with_no_data() {
-    assertThat(underTest.getFailures()).isEqualTo(0);
-    assertThat(underTest.getSuccess()).isEqualTo(0);
-    assertThat(underTest.getTotal()).isEqualTo(0);
+    assertThat(underTest.getFailures()).isZero();
+    assertThat(underTest.getSuccess()).isZero();
+    assertThat(underTest.getTotal()).isZero();
     assertThat(underTest.getSuccessRatio()).isEqualTo(1.0);
     assertThat(underTest.isSuccess()).isTrue();
   }
index f0f7f7a27f27ea0f9772a59a5944b9df320732d5..73fd5835db4e44168ab140cbe7942d7b71d99fb9 100644 (file)
@@ -41,7 +41,7 @@ public class SearchOptionsTest {
 
     assertThat(options.getFacets()).isEmpty();
     assertThat(options.getFields()).isEmpty();
-    assertThat(options.getOffset()).isEqualTo(0);
+    assertThat(options.getOffset()).isZero();
     assertThat(options.getLimit()).isEqualTo(10);
     assertThat(options.getPage()).isEqualTo(1);
   }
@@ -58,7 +58,7 @@ public class SearchOptionsTest {
   public void page_starts_at_one() {
     SearchOptions options = new SearchOptions().setPage(1, 10);
     assertThat(options.getLimit()).isEqualTo(10);
-    assertThat(options.getOffset()).isEqualTo(0);
+    assertThat(options.getOffset()).isZero();
     assertThat(options.getPage()).isEqualTo(1);
   }
 
index 0c85a703e82caceb70f96bb588c0d29527f4f9a8..8073a816dfe8a803fa6cc13751dd525a3756ffaf 100644 (file)
@@ -159,7 +159,7 @@ public class NewIssuesStatisticsTest {
     DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.COMPONENT);
     Stream.of(globalDistribution, assigneeDistribution)
       .forEach(distribution -> {
-        assertThat(distribution.getTotal()).isEqualTo(0);
+        assertThat(distribution.getTotal()).isZero();
         assertThat(distribution.getForLabel(null).isPresent()).isFalse();
       });
   }
@@ -204,7 +204,7 @@ public class NewIssuesStatisticsTest {
     DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.RULE);
     Stream.of(globalDistribution, assigneeDistribution)
       .forEach(distribution -> {
-        assertThat(distribution.getTotal()).isEqualTo(0);
+        assertThat(distribution.getTotal()).isZero();
         assertThat(distribution.getForLabel(null).isPresent()).isFalse();
       });
   }
@@ -249,14 +249,14 @@ public class NewIssuesStatisticsTest {
     assignees.forEach(assignee -> {
       NewIssuesStatistics.Stats stats = underTest.getAssigneesStatistics().get(assignee);
       DistributedMetricStatsInt assigneeStats = stats.getDistributedMetricStats(Metric.ASSIGNEE);
-      assertThat(assigneeStats.getOnCurrentAnalysis()).isEqualTo(0);
+      assertThat(assigneeStats.getOnCurrentAnalysis()).isZero();
       assertThat(assigneeStats.getTotal()).isEqualTo(1);
       assignees.forEach(s -> {
         Optional<MetricStatsInt> forLabelOpts = assigneeStats.getForLabel(s);
         if (s.equals(assignee)) {
           assertThat(forLabelOpts.isPresent()).isTrue();
           MetricStatsInt forLabel = forLabelOpts.get();
-          assertThat(forLabel.getOnCurrentAnalysis()).isEqualTo(0);
+          assertThat(forLabel.getOnCurrentAnalysis()).isZero();
           assertThat(forLabel.getTotal()).isEqualTo(1);
         } else {
           assertThat(forLabelOpts.isPresent()).isFalse();
@@ -270,7 +270,7 @@ public class NewIssuesStatisticsTest {
     underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(null).setNew(new Random().nextBoolean()));
 
     DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.ASSIGNEE);
-    assertThat(globalDistribution.getTotal()).isEqualTo(0);
+    assertThat(globalDistribution.getTotal()).isZero();
     assertThat(globalDistribution.getForLabel(null).isPresent()).isFalse();
     assertThat(underTest.getAssigneesStatistics()).isEmpty();
   }
@@ -308,7 +308,7 @@ public class NewIssuesStatisticsTest {
     DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.TAG);
     Stream.of(globalDistribution, assigneeDistribution)
       .forEach(distribution -> {
-        assertThat(distribution.getTotal()).isEqualTo(0);
+        assertThat(distribution.getTotal()).isZero();
         assertThat(distribution.getForLabel(null).isPresent()).isFalse();
       });
   }
@@ -328,7 +328,7 @@ public class NewIssuesStatisticsTest {
     Stream.of(globalDistribution, assigneeDistribution)
       .forEach(distribution -> {
         assertThat(distribution.getOnCurrentAnalysis()).isEqualTo(expected);
-        assertThat(distribution.getOffCurrentAnalysis()).isEqualTo(0);
+        assertThat(distribution.getOffCurrentAnalysis()).isZero();
         assertThat(distribution.getTotal()).isEqualTo(expected);
       });
   }
@@ -347,7 +347,7 @@ public class NewIssuesStatisticsTest {
     MetricStatsLong assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).effort();
     Stream.of(globalDistribution, assigneeDistribution)
       .forEach(distribution -> {
-        assertThat(distribution.getOnCurrentAnalysis()).isEqualTo(0);
+        assertThat(distribution.getOnCurrentAnalysis()).isZero();
         assertThat(distribution.getOffCurrentAnalysis()).isEqualTo(expected);
         assertThat(distribution.getTotal()).isEqualTo(expected);
       });
@@ -361,7 +361,7 @@ public class NewIssuesStatisticsTest {
     MetricStatsLong globalDistribution = underTest.globalStatistics().effort();
     MetricStatsLong assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).effort();
     Stream.of(globalDistribution, assigneeDistribution)
-      .forEach(distribution -> assertThat(distribution.getTotal()).isEqualTo(0));
+      .forEach(distribution -> assertThat(distribution.getTotal()).isZero());
   }
 
   @Test
index f8a3dbe9dcb011c52859c1c6ed2b3d24b7c8bc9e..d03deb7c8318a76268c2b1979354908406022bf7 100644 (file)
@@ -244,7 +244,7 @@ public class ProjectMeasuresIndexerTest {
     db.getDbClient().purgeDao().deleteProject(db.getSession(), project.uuid());
     IndexingResult result = indexProject(project, PROJECT_DELETION);
 
-    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero();
     assertThat(result.getTotal()).isEqualTo(1L);
     assertThat(result.getSuccess()).isEqualTo(1L);
   }
@@ -257,7 +257,7 @@ public class ProjectMeasuresIndexerTest {
 
     underTest.index(db.getSession(), emptyList());
 
-    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero();
   }
 
   @Test
@@ -273,7 +273,7 @@ public class ProjectMeasuresIndexerTest {
     result = recover();
     assertThat(result.getTotal()).isEqualTo(1L);
     assertThat(result.getFailures()).isEqualTo(1L);
-    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero();
     assertThatEsQueueTableHasSize(1);
 
     es.unlockWrites(TYPE_PROJECT_MEASURES);
@@ -292,7 +292,7 @@ public class ProjectMeasuresIndexerTest {
 
     underTest.indexOnAnalysis(branch.uuid());
 
-    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_PROJECT_MEASURES)).isZero();
   }
 
   private IndexingResult indexProject(ComponentDto project, ProjectIndexer.Cause cause) {
index 7997c3f1f82811fc625487f0e0fa22859a7301d4..7f88a5b4c08f0177b642b9acfd3ef4849ee3a00c 100644 (file)
@@ -107,7 +107,7 @@ public class DefaultNotificationManagerTest {
     assertThat(underTest.getChannels()).containsOnly(emailChannel, twitterChannel);
 
     underTest = new DefaultNotificationManager(new NotificationChannel[] {}, dbClient);
-    assertThat(underTest.getChannels()).hasSize(0);
+    assertThat(underTest.getChannels()).isEmpty();
   }
 
   @Test
@@ -150,7 +150,7 @@ public class DefaultNotificationManagerTest {
   @Test
   public void shouldFindNoRecipient() {
     assertThat(underTest.findSubscribedRecipientsForDispatcher(dispatcher, "uuid_45", new SubscriberPermissionsOnProject(UserRole.USER)).asMap().entrySet())
-      .hasSize(0);
+      .isEmpty();
   }
 
   @Test
index e37f3dd598da6ba0b1d7c0084dfd6f3a86b2414b..48d6f10f0faea8b0410d0d29d8e0dc8fc9eeb5c3 100644 (file)
@@ -66,12 +66,12 @@ public class ProcessInfoProviderTest {
       new TestSystemInfoSection("foo"),
       new TestSystemInfoSection("bar")});
 
-    assertThat(ProcessInfoProvider.provide().getSectionsCount()).isEqualTo(0);
+    assertThat(ProcessInfoProvider.provide().getSectionsCount()).isZero();
 
     underTest.start();
     assertThat(ProcessInfoProvider.provide().getSectionsCount()).isEqualTo(2);
 
     underTest.stop();
-    assertThat(ProcessInfoProvider.provide().getSectionsCount()).isEqualTo(0);
+    assertThat(ProcessInfoProvider.provide().getSectionsCount()).isZero();
   }
 }
index b159e414d40562f189716da3fe92be00b4660667..c67de1a8af6f2e4badaf7a55b050efc5649ed100 100644 (file)
@@ -119,7 +119,7 @@ public class ActiveRuleIndexerTest {
 
     underTest.commitAndIndex(db.getSession(), Collections.emptyList());
 
-    assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero();
     assertThatEsQueueTableIsEmpty();
   }
 
@@ -144,7 +144,7 @@ public class ActiveRuleIndexerTest {
     db.getDbClient().activeRuleDao().delete(db.getSession(), ar.getKey());
     commitAndIndex(rule1, ar);
 
-    assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero();
     assertThatEsQueueTableIsEmpty();
   }
 
@@ -156,7 +156,7 @@ public class ActiveRuleIndexerTest {
     underTest.index(db.getSession(), singletonList(item));
 
     assertThatEsQueueTableIsEmpty();
-    assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isEqualTo(0);
+    assertThat(es.countDocuments(TYPE_ACTIVE_RULE)).isZero();
   }
 
   @Test
@@ -184,7 +184,7 @@ public class ActiveRuleIndexerTest {
   }
 
   private void assertThatEsQueueTableIsEmpty() {
-    assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isZero();
   }
 
   private void assertThatEsQueueContainsExactly(EsQueueDto expected) {
index be13bf857288de19eb9aa38cb4ffcbf83aa88895..0f465d8eeba898ddb96907a78677f5805c8ab747 100644 (file)
@@ -324,7 +324,7 @@ public class RuleIndexTest {
     SearchOptions options = new SearchOptions().addFacets(FACET_TAGS);
 
     // do not fail
-    assertThat(underTest.search(query, options).getTotal()).isEqualTo(0);
+    assertThat(underTest.search(query, options).getTotal()).isZero();
   }
 
   @Test
index 52ac0374bac346827a4f89d745b4a68113e8de2d..b4f52fd565bc2f9f1e9a3b9abd1d68a943e3916c 100644 (file)
@@ -98,7 +98,7 @@ public class SynchronousWebHooksImplTest {
 
     underTest.sendProjectAnalysisUpdate(new WebHooks.Analysis(componentDto.uuid(), "1", "#1"), () -> mock);
 
-    assertThat(caller.countSent()).isEqualTo(0);
+    assertThat(caller.countSent()).isZero();
     assertThat(logTester.logs(DEBUG)).isEmpty();
     verifyZeroInteractions(deliveryStorage);
   }
@@ -109,7 +109,7 @@ public class SynchronousWebHooksImplTest {
 
     underTest.sendProjectAnalysisUpdate(new WebHooks.Analysis(componentDto.uuid(), "1", "#1"), () -> mock, taskStatistics);
 
-    assertThat(caller.countSent()).isEqualTo(0);
+    assertThat(caller.countSent()).isZero();
     assertThat(logTester.logs(DEBUG)).isEmpty();
     verifyZeroInteractions(deliveryStorage);
     verifyLogStatistics(0, 0);
index 57dee7d4e35dbfa6c00a58735b5d7b12df0f929b..80ae43aec20634f48142c4745db643570b152368 100644 (file)
@@ -252,7 +252,7 @@ public class PluginDownloaderTest {
   @Test
   public void getDownloadedPluginFilenames_reads_plugin_info_of_files_in_download_folder() throws Exception {
     pluginDownloader.start();
-    assertThat(pluginDownloader.getDownloadedPlugins()).hasSize(0);
+    assertThat(pluginDownloader.getDownloadedPlugins()).isEmpty();
 
     File file1 = new File(downloadDir, "file1.jar");
     file1.createNewFile();
index cfe99b6f942b32d2576555e43a3f4336c2cdfb5d..03fd7671e10aa89d62420a0a894f23b45e45838e 100644 (file)
@@ -167,7 +167,7 @@ public class JwtCsrfVerifierTest {
     verify(response).addCookie(cookieArgumentCaptor.capture());
     Cookie cookie = cookieArgumentCaptor.getValue();
     assertThat(cookie.getValue()).isNull();
-    assertThat(cookie.getMaxAge()).isEqualTo(0);
+    assertThat(cookie.getMaxAge()).isZero();
   }
 
   private void verifyCookie(Cookie cookie) {
index 70316548b5fe64e57dfc69d9da498127769e631b..9e33c05063270f9263c832a54fd04e0fe60818d5 100644 (file)
@@ -191,6 +191,6 @@ public class OAuth2AuthenticationParametersImplTest {
     assertThat(updatedCookie.getName()).isEqualTo(AUTHENTICATION_COOKIE_NAME);
     assertThat(updatedCookie.getValue()).isNull();
     assertThat(updatedCookie.getPath()).isEqualTo("/");
-    assertThat(updatedCookie.getMaxAge()).isEqualTo(0);
+    assertThat(updatedCookie.getMaxAge()).isZero();
   }
 }
index 3689055ffa821a1c37c7fbbe5d7fa1ed1ff50455..be57dae887c35d809aa0b3759450e2186dd194e5 100644 (file)
@@ -83,7 +83,7 @@ public class OAuthCsrfVerifierTest {
     assertThat(updatedCookie.getName()).isEqualTo("OAUTHSTATE");
     assertThat(updatedCookie.getValue()).isNull();
     assertThat(updatedCookie.getPath()).isEqualTo("/");
-    assertThat(updatedCookie.getMaxAge()).isEqualTo(0);
+    assertThat(updatedCookie.getMaxAge()).isZero();
   }
 
   @Test
@@ -99,7 +99,7 @@ public class OAuthCsrfVerifierTest {
     assertThat(updatedCookie.getName()).isEqualTo("OAUTHSTATE");
     assertThat(updatedCookie.getValue()).isNull();
     assertThat(updatedCookie.getPath()).isEqualTo("/");
-    assertThat(updatedCookie.getMaxAge()).isEqualTo(0);
+    assertThat(updatedCookie.getMaxAge()).isZero();
   }
 
   @Test
index bbd1e5f9b4015c82aa4e330e0030ae1d55a382fe..0b17ed1b09694e57b587dbe4454b68ce0e34acf7 100644 (file)
@@ -77,7 +77,7 @@ public class CeHttpClientImplTest {
     setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE);
 
     Optional<ProtobufSystemInfo.SystemInfo> info = underTest.retrieveSystemInfo();
-    assertThat(info.get().getSectionsCount()).isEqualTo(0);
+    assertThat(info.get().getSectionsCount()).isZero();
   }
 
   @Test
index 39a67cee288da2523fc3adbd830e077723afb9dd..744d312b44a83a648f53567f25b97368d189bdf8 100644 (file)
@@ -208,7 +208,7 @@ public class NotificationMediumTest {
     Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
 
     service = new NotificationService(dbClient);
-    assertThat(service.getDispatchers()).hasSize(0);
+    assertThat(service.getDispatchers()).isEmpty();
   }
 
   @Test
index 0227e4908f3d597e824cdd1b340cc2fcb8f98baa..d1cad4df23fd46311721c9b8ec3a39ab9b5cfe06 100644 (file)
@@ -452,7 +452,7 @@ public class RegisterRulesTest {
     assertThat(rule1.getDescription()).isEqualTo("Description");
 
     assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name2"), new SearchOptions()).getTotal()).isEqualTo(1);
-    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isEqualTo(0);
+    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isZero();
   }
 
   @Test
@@ -533,7 +533,7 @@ public class RegisterRulesTest {
     SearchIdResult<String> searchRule2 = ruleIndex.search(new RuleQuery().setQueryText("Name2"), new SearchOptions());
     assertThat(searchRule2.getUuids()).containsOnly(rule2.getUuid());
     assertThat(searchRule2.getTotal()).isEqualTo(1);
-    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isEqualTo(0);
+    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isZero();
   }
 
   @Test
@@ -575,7 +575,7 @@ public class RegisterRulesTest {
     SearchIdResult<String> searchRule2 = ruleIndex.search(new RuleQuery().setQueryText("Name2"), new SearchOptions());
     assertThat(searchRule2.getUuids()).containsOnly(rule2.getUuid());
     assertThat(searchRule2.getTotal()).isEqualTo(1);
-    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isEqualTo(0);
+    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Name1"), new SearchOptions()).getTotal()).isZero();
   }
 
   @Test
@@ -691,7 +691,7 @@ public class RegisterRulesTest {
     assertThat(rule1.getDescription()).isEqualTo("Desc2");
 
     assertThat(ruleIndex.search(new RuleQuery().setQueryText("Desc2"), new SearchOptions()).getTotal()).isEqualTo(1);
-    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Desc1"), new SearchOptions()).getTotal()).isEqualTo(0);
+    assertThat(ruleIndex.search(new RuleQuery().setQueryText("Desc1"), new SearchOptions()).getTotal()).isZero();
   }
 
   @Test
@@ -748,7 +748,7 @@ public class RegisterRulesTest {
 
     RuleDto rule = dbClient.ruleDao().selectOrFailByKey(db.getSession(), RULE_KEY1);
     assertThat(rule.getStatus()).isEqualTo(REMOVED);
-    assertThat(ruleIndex.search(new RuleQuery().setKey(RULE_KEY1.toString()), new SearchOptions()).getTotal()).isEqualTo(0);
+    assertThat(ruleIndex.search(new RuleQuery().setKey(RULE_KEY1.toString()), new SearchOptions()).getTotal()).isZero();
 
     // Re-install rule
     system.setNow(DATE3.getTime());
@@ -899,7 +899,7 @@ public class RegisterRulesTest {
 
     assertThat(dbClient.ruleDao().selectAllDefinitions(db.getSession())).hasSize(1);
     deprecatedRuleKeys = dbClient.ruleDao().selectAllDeprecatedRuleKeys(db.getSession());
-    assertThat(deprecatedRuleKeys).hasSize(0);
+    assertThat(deprecatedRuleKeys).isEmpty();
   }
 
   @Test
index 4d78374bbd74e2adf9e953a1a3f82a60ade09446..2e3e2b9fee03e811368a8f09b602fca492d5f2bf 100644 (file)
@@ -245,7 +245,7 @@ public class IndexCreatorTest {
       // keep existing metadata
       .doesNotContain("Create type metadatas/metadata");
     // index has been dropped and re-created
-    assertThat(es.countDocuments(FakeIndexDefinition.INDEX_TYPE)).isEqualTo(0);
+    assertThat(es.countDocuments(FakeIndexDefinition.INDEX_TYPE)).isZero();
   }
 
   private ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetadata>> mappings() {
index a975d00151761698ce4ae3cf0f29034d7ded3ba8..c2e3289101ffe81f7b9462b02200492029ca0bb3 100644 (file)
@@ -105,7 +105,7 @@ public class PermissionIndexerTest {
 
     underTest.index(db.getSession(), esQueueDtos);
 
-    assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isZero();
     assertThat(es.countDocuments(INDEX_TYPE_FOO_AUTH)).isEqualTo(1);
   }
 
index a8faae732fc61598865e058101a23f47949fbce7..165582467ebef1e48f0137267afd587b73c69340 100644 (file)
@@ -161,7 +161,7 @@ public class ActivityActionTest {
       .setParam("status", "FAILED,IN_PROGRESS,SUCCESS")
       .setParam(PARAM_MAX_EXECUTED_AT, "2016-02-15"));
 
-    assertThat(activityResponse.getTasksCount()).isEqualTo(0);
+    assertThat(activityResponse.getTasksCount()).isZero();
   }
 
   @Test
index 5d47f920fa2a9b29545c1b7fe42caca9c0d10d40..a3038fa8c63b43a2cdc14e519f6ae45925fc30bf 100644 (file)
@@ -144,8 +144,8 @@ public class ActivityStatusActionTest {
   public void empty_status() {
     Ce.ActivityStatusWsResponse result = call();
 
-    assertThat(result.getPending()).isEqualTo(0);
-    assertThat(result.getFailing()).isEqualTo(0);
+    assertThat(result.getPending()).isZero();
+    assertThat(result.getFailing()).isZero();
   }
 
   @Test
index ea4df38a0b19f2e27d7e0aa64ddfa1694919d417..759f86258b854142ab84b4f012fda464214c4501 100644 (file)
@@ -82,7 +82,7 @@ public class ComponentActionTest {
       .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(Ce.ComponentResponse.class);
 
-    assertThat(response.getQueueCount()).isEqualTo(0);
+    assertThat(response.getQueueCount()).isZero();
     assertThat(response.hasCurrent()).isFalse();
   }
 
@@ -167,7 +167,7 @@ public class ComponentActionTest {
     Ce.ComponentResponse response = ws.newRequest()
       .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(Ce.ComponentResponse.class);
-    assertThat(response.getQueueCount()).isEqualTo(0);
+    assertThat(response.getQueueCount()).isZero();
     // T3 is the latest task executed on PROJECT_1 ignoring Canceled ones
     assertThat(response.hasCurrent()).isTrue();
     Ce.Task current = response.getCurrent();
index 230d59b20123e1f370cce9a2491201442cd68444..c161cbb81cdd0f6f84ad2072efa2df48c34be582 100644 (file)
@@ -321,11 +321,11 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request);
 
-    assertThat(result.getComponentsCount()).isEqualTo(0);
+    assertThat(result.getComponentsCount()).isZero();
     Common.Paging paging = result.getPaging();
     assertThat(paging.getPageIndex()).isEqualTo(1);
     assertThat(paging.getPageSize()).isEqualTo(100);
-    assertThat(paging.getTotal()).isEqualTo(0);
+    assertThat(paging.getTotal()).isZero();
   }
 
   @Test
index 8afb0bff82a7b88e7c22a3eeed81d797ac714041..68e98c3f3fbc0a67c5b305fcbc8e986f16dee9d3 100644 (file)
@@ -308,7 +308,7 @@ public class TreeActionTest {
 
     assertThat(response.getBaseComponent().getKey()).isEqualTo(project.getDbKey());
     assertThat(response.getComponentsList()).isEmpty();
-    assertThat(response.getPaging().getTotal()).isEqualTo(0);
+    assertThat(response.getPaging().getTotal()).isZero();
     assertThat(response.getPaging().getPageSize()).isEqualTo(100);
     assertThat(response.getPaging().getPageIndex()).isEqualTo(1);
   }
index a4a70e1cc40784c4ab84f3e026394d9b9cea1da3..d902436a5fd10415b2244d19114afa51056f660a 100644 (file)
@@ -98,7 +98,7 @@ public class SearchActionTest {
   public void empty_list() {
     SearchResponse result = call();
 
-    assertThat(result.getFavoritesCount()).isEqualTo(0);
+    assertThat(result.getFavoritesCount()).isZero();
     assertThat(result.getFavoritesList()).isEmpty();
   }
 
index 3882011f0ef3694916f7994e6a64792cae17bdb5..3e3e655e70892ad8aa7a055c5312c1d6c41e3f7b 100644 (file)
@@ -164,7 +164,7 @@ public class WebIssueStorageTest {
     underTest.save(db.getSession(), singletonList(issue));
 
     assertThat(db.countRowsOfTable("issues")).isEqualTo(1);
-    assertThat(db.countRowsOfTable("issue_changes")).isEqualTo(0);
+    assertThat(db.countRowsOfTable("issue_changes")).isZero();
 
     DefaultIssue updated = new DefaultIssue()
       .setKey(issue.key())
index 6aab3109298813a66a265c013506ca1aa003033b..9e087c9ff47580f1b747ff72b383c6dd31d123eb 100644 (file)
@@ -250,7 +250,7 @@ public class LiveMeasureComputerImplTest {
   public void do_nothing_if_project_has_not_been_analyzed() {
     // project has no snapshots
     List<QGChangeEvent> result = run(file1, newIncrementalFormula());
-    assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isZero();
     assertThatProjectNotChanged(result, project);
   }
 
@@ -258,7 +258,7 @@ public class LiveMeasureComputerImplTest {
   public void do_nothing_if_input_components_are_empty() {
     List<QGChangeEvent> result = run(emptyList(), newIncrementalFormula());
 
-    assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(db.getSession(), "live_measures")).isZero();
     assertThatProjectNotChanged(result, project);
   }
 
@@ -507,6 +507,6 @@ public class LiveMeasureComputerImplTest {
 
   private void assertThatProjectNotChanged(List<QGChangeEvent> events, ComponentDto project) {
     assertThat(projectIndexer.hasBeenCalled(project.uuid(), ProjectIndexer.Cause.MEASURE_CHANGE)).isFalse();
-    assertThat(events).hasSize(0);
+    assertThat(events).isEmpty();
   }
 }
index c9d672e0db726534b02364585c011d877207a301..68ace74a17d74205f9a4bdb0e2bd07a6559e09a5 100644 (file)
@@ -98,7 +98,7 @@ public class ComponentActionTest {
 
     assertThat(response.getMetrics().getMetricsCount()).isEqualTo(1);
     assertThat(response.hasPeriod()).isFalse();
-    assertThat(response.getPeriods().getPeriodsCount()).isEqualTo(0);
+    assertThat(response.getPeriods().getPeriodsCount()).isZero();
     assertThat(response.getComponent().getKey()).isEqualTo(project.getDbKey());
   }
 
index 6080cebae15b3c46f984fefe7d357a93494ec844..4790e657094af259d88748d4ec48c68c05a188a7 100644 (file)
@@ -524,7 +524,7 @@ public class ComponentTreeActionTest {
       .executeProtobuf(ComponentTreeWsResponse.class);
 
     assertThat(result.getBaseComponent().getKey()).isEqualTo(project.getKey());
-    assertThat(result.getComponentsCount()).isEqualTo(0);
+    assertThat(result.getComponentsCount()).isZero();
   }
 
   @Test
index ecbaebd9b8c808d64b03c1e797405483336249d4..18b35e2d157bd3194ddfe7b10704e10cce6a9d42 100644 (file)
@@ -269,7 +269,7 @@ public class SearchActionTest {
 
     userSession.setNonRoot();
     SearchWsResponse result = call(singletonList(project1.getDbKey()), singletonList(metric.getKey()));
-    assertThat(result.getMeasuresCount()).isEqualTo(0);
+    assertThat(result.getMeasuresCount()).isZero();
 
     userSession.setRoot();
     result = call(singletonList(project1.getDbKey()), singletonList(metric.getKey()));
index 3ec17c1833398255ae8fb6bb8414faed16b85a0f..b2209f6c6a895819043ebf4cfcb98c2b67f99464 100644 (file)
@@ -119,7 +119,7 @@ public class SearchHistoryActionTest {
     SearchHistoryResponse result = call(request);
 
     assertThat(result.getMeasuresList()).hasSize(1);
-    assertThat(result.getMeasures(0).getHistoryCount()).isEqualTo(0);
+    assertThat(result.getMeasures(0).getHistoryCount()).isZero();
 
     assertThat(result.getPaging()).extracting(Paging::getPageIndex, Paging::getPageSize, Paging::getTotal)
       // pagination is applied to the number of analyses
index 600efa98b439f6b4b5604fb9b8a23b61a0ae58a0..9f641537a9709139291622d095d99d383b3dc30f 100644 (file)
@@ -88,7 +88,7 @@ public class CreateActionTest {
     assertThat(metric.getDomain()).isNull();
     assertThat(metric.isUserManaged()).isTrue();
     assertThat(metric.isEnabled()).isTrue();
-    assertThat(metric.getDirection()).isEqualTo(0);
+    assertThat(metric.getDirection()).isZero();
     assertThat(metric.isQualitative()).isFalse();
   }
 
index 5d487bf550a0ab3914c0c7595d8441dfa7368455..3beca41305b2af66493c9026626fdbc5eb1c74a7 100644 (file)
@@ -218,7 +218,7 @@ public class UnsetActionTest {
   }
 
   private void assertTableEmpty() {
-    assertThat(db.countRowsOfTable(dbSession, "new_code_periods")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(dbSession, "new_code_periods")).isZero();
   }
 
   private void assertTableContainsOnly(@Nullable String projectUuid, @Nullable String branchUuid, NewCodePeriodType type, @Nullable String value) {
index c6a2b99afed879545193ef07a1630eba67f6f7c8..512a1324e3158653a629bc0f986012a3ed361546 100644 (file)
@@ -67,10 +67,10 @@ public class NotificationCenterTest {
     assertThat(underTest.getChannels()).hasSize(1);
 
     underTest = new NotificationCenter();
-    assertThat(underTest.getChannels()).hasSize(0);
+    assertThat(underTest.getChannels()).isEmpty();
 
     underTest = new NotificationCenter(new NotificationDispatcherMetadata[] {NotificationDispatcherMetadata.create("Dispatcher1").setProperty("global", "true")});
-    assertThat(underTest.getChannels()).hasSize(0);
+    assertThat(underTest.getChannels()).isEmpty();
     assertThat(underTest.getDispatcherKeysForProperty("global", null)).hasSize(1);
   }
 
index 8cfea6a15016d1e05bf7ab6ebddf448864e0929e..172669a78db438d368dbcb1565d05613ad479afd 100644 (file)
@@ -217,7 +217,7 @@ public class OrganizationDeleterTest {
     assertThat(db.getDbClient().organizationMemberDao().select(db.getSession(), org.getUuid(), user1.getUuid())).isNotPresent();
     assertThat(db.getDbClient().organizationMemberDao().select(db.getSession(), org.getUuid(), user2.getUuid())).isNotPresent();
     assertThat(db.getDbClient().organizationMemberDao().select(db.getSession(), otherOrg.getUuid(), user1.getUuid())).isPresent();
-    assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(org.getUuid()).build(), new SearchOptions()).getTotal()).isEqualTo(0);
+    assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(org.getUuid()).build(), new SearchOptions()).getTotal()).isZero();
     assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(otherOrg.getUuid()).build(), new SearchOptions()).getTotal()).isEqualTo(1);
     verify(projectLifeCycleListeners).onProjectsDeleted(emptySet());
   }
index 253fccbdbbf74fe026b8a3ea9001518a5086d524..a2052388d4a40669d85bc69c6db35ace89e9a056 100644 (file)
@@ -68,7 +68,7 @@ public class SearchGlobalPermissionsActionTest extends BasePermissionWsTest<Sear
       if (permission.getKey().equals(SCAN_EXECUTION)) {
         assertThat(permission.getUsersCount()).isEqualTo(1);
       } else {
-        assertThat(permission.getUsersCount()).isEqualTo(0);
+        assertThat(permission.getUsersCount()).isZero();
       }
     }
   }
index 45ceef493821459d93990ce9a25ca44a797b6c7b..6211bf2afa0259b2fd7bf192fc6bbf469565508d 100644 (file)
@@ -612,7 +612,7 @@ public class SearchActionTest {
 
     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
index d77aa95e4da038ba1ffa60f681d11c2cbc9e20c0..8d909e4910e44277a1909867542c62dc075256da 100644 (file)
@@ -282,7 +282,7 @@ public class ProjectStatusActionTest {
       .executeProtobuf(ProjectStatusResponse.class);
 
     assertThat(result.getProjectStatus().getStatus()).isEqualTo(Status.NONE);
-    assertThat(result.getProjectStatus().getConditionsCount()).isEqualTo(0);
+    assertThat(result.getProjectStatus().getConditionsCount()).isZero();
   }
 
   @Test
@@ -296,7 +296,7 @@ public class ProjectStatusActionTest {
       .executeProtobuf(ProjectStatusResponse.class);
 
     assertThat(result.getProjectStatus().getStatus()).isEqualTo(Status.NONE);
-    assertThat(result.getProjectStatus().getConditionsCount()).isEqualTo(0);
+    assertThat(result.getProjectStatus().getConditionsCount()).isZero();
   }
 
   @Test
index f741a145e4a456b744a166940db542e00643ceb5..f774587d03dddfe6499db818e16eb0957cc6aecd 100644 (file)
@@ -422,7 +422,7 @@ public class QProfileRuleImplTest {
 
     List<ActiveRuleChange> changes = deactivate(profile, rule);
     verifyNoActiveRules();
-    assertThat(changes).hasSize(0);
+    assertThat(changes).isEmpty();
   }
 
   @Test
@@ -576,7 +576,7 @@ public class QProfileRuleImplTest {
     List<ActiveRuleChange> changes = activate(childProfile, overrideActivation);
 
     assertThatRuleIsUpdated(childProfile, rule, MAJOR, INHERITED, of(param.getName(), "foo"));
-    assertThat(changes).hasSize(0);
+    assertThat(changes).isEmpty();
   }
 
   @Test
@@ -702,7 +702,7 @@ public class QProfileRuleImplTest {
     RuleActivation resetActivation = RuleActivation.createReset(rule.getUuid());
     List<ActiveRuleChange> changes = activate(parentProfile, resetActivation);
     verifyNoActiveRules();
-    assertThat(changes).hasSize(0);
+    assertThat(changes).isEmpty();
   }
 
   @Test
@@ -724,7 +724,7 @@ public class QProfileRuleImplTest {
 
     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);
@@ -751,7 +751,7 @@ public class QProfileRuleImplTest {
 
     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);
@@ -759,10 +759,10 @@ public class QProfileRuleImplTest {
     // 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()));
   }
@@ -784,8 +784,8 @@ public class QProfileRuleImplTest {
     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());
   }
@@ -810,7 +810,7 @@ public class QProfileRuleImplTest {
 
     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());
@@ -954,7 +954,7 @@ public class QProfileRuleImplTest {
   }
 
   private void verifyNoActiveRules() {
-    assertThat(db.countRowsOfTable(db.getSession(), "active_rules")).isEqualTo(0);
+    assertThat(db.countRowsOfTable(db.getSession(), "active_rules")).isZero();
   }
 
   private RuleDefinitionDto createRule() {
index eed8dd286eba424159125e608738871bb573989b..16e3dfd4fc8c91f5198108ff241b90aeb3056fa7 100644 (file)
@@ -175,7 +175,7 @@ public class QProfilesWsMediumTest {
     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);
   }
 
@@ -339,7 +339,7 @@ public class QProfilesWsMediumTest {
     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")
index 0dd76c5e6a10becc4218b1c978214d377d7fa615..0f65e4760aadb68cfabf15a22da09cc1312c3601 100644 (file)
@@ -147,7 +147,7 @@ public class SearchActionTest {
 
     assertThat(response.getTotal()).isEqualTo(0L);
     assertThat(response.getP()).isEqualTo(1);
-    assertThat(response.getRulesCount()).isEqualTo(0);
+    assertThat(response.getRulesCount()).isZero();
   }
 
   @Test
index 971b767aefa26973b0620fde14a7aec1ea848623..936d0ec9afc9086c0d0fa5eb8162d31c7b9934d7 100644 (file)
@@ -83,7 +83,7 @@ public class CheckSecretKeyActionTest {
     assertThat(definition.isInternal()).isTrue();
     assertThat(definition.since()).isEqualTo("6.1");
     assertThat(definition.responseExampleAsString()).isNotEmpty();
-    assertThat(definition.params()).hasSize(0);
+    assertThat(definition.params()).isEmpty();
   }
 
   @Test
index ffa3862a6fb71270918e3de80da5be4715342d98..7e18aebf2d55a8b500b02e6e9e07dfc805d348bc 100644 (file)
@@ -71,7 +71,7 @@ public class GenerateSecretKeyActionTest {
     assertThat(definition.isPost()).isFalse();
     assertThat(definition.isInternal()).isTrue();
     assertThat(definition.responseExampleAsString()).isNotEmpty();
-    assertThat(definition.params()).hasSize(0);
+    assertThat(definition.params()).isEmpty();
   }
 
   @Test
index c0425a33b5e42012a815ab0d3a2e202bcf316234..e18792c4152fc150df180f10434bc67f28abc4a2 100644 (file)
@@ -113,7 +113,7 @@ public class DeleteActionTest {
     assertThat(reloaded).isEmpty();
 
     int deliveriesCount = deliveryDao.countDeliveriesByWebhookUuid(dbSession, dto.getUuid());
-    assertThat(deliveriesCount).isEqualTo(0);
+    assertThat(deliveriesCount).isZero();
 
   }
 
@@ -136,7 +136,7 @@ public class DeleteActionTest {
     assertThat(reloaded).isEmpty();
 
     int deliveriesCount = deliveryDao.countDeliveriesByWebhookUuid(dbSession, dto.getUuid());
-    assertThat(deliveriesCount).isEqualTo(0);
+    assertThat(deliveriesCount).isZero();
   }
 
   @Test
index a67677fdb0bcd3155f4c28eab82a06e88fbfaf5e..592d133ef9c57dc1e66ffc01bac9e6ae4a1710e3 100644 (file)
@@ -92,7 +92,7 @@ public class WebhookDeliveriesActionTest {
       .setParam("componentKey", project.getDbKey())
       .executeProtobuf(Webhooks.DeliveriesWsResponse.class);
 
-    assertThat(response.getDeliveriesCount()).isEqualTo(0);
+    assertThat(response.getDeliveriesCount()).isZero();
   }
 
   @Test
@@ -103,7 +103,7 @@ public class WebhookDeliveriesActionTest {
       .setParam("ceTaskId", "t1")
       .executeProtobuf(Webhooks.DeliveriesWsResponse.class);
 
-    assertThat(response.getDeliveriesCount()).isEqualTo(0);
+    assertThat(response.getDeliveriesCount()).isZero();
   }
 
   @Test
@@ -114,7 +114,7 @@ public class WebhookDeliveriesActionTest {
       .setParam("webhook", "t1")
       .executeProtobuf(Webhooks.DeliveriesWsResponse.class);
 
-    assertThat(response.getDeliveriesCount()).isEqualTo(0);
+    assertThat(response.getDeliveriesCount()).isZero();
   }
 
   @Test
index 1aa2c1c1864b122db2777694621645d048ec74a7..6d05c75ffd52949cc8133a7328c24e24a5be3520 100644 (file)
@@ -219,6 +219,6 @@ public class DefaultIssueTest {
 
     issue.addChange(null);
 
-    assertThat(issue.changes()).hasSize(0);
+    assertThat(issue.changes()).isEmpty();
   }
 }
index 752f1125ee1692df008e6d60f9c531304012ca6b..f4f917b44f65a61fa8e13122dadf24c148206a83 100644 (file)
@@ -159,16 +159,16 @@ public class FieldDiffsTest {
     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
@@ -191,12 +191,12 @@ public class FieldDiffsTest {
     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
index 89c17cefed75c35b945484d4eb164592822c1b4c..4a7ae3600a452fa95aa1736a6ff1ea4b708123f3 100644 (file)
@@ -37,7 +37,7 @@ public class BlockRecognizerTest {
     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);
   }
 
index ea06b9292394590bb2bf804df8f9a18fded90292..ed6703835e75e314f7e0f42c7f9441c8ec9d2110 100644 (file)
@@ -444,7 +444,7 @@ public class TrackerTest {
     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);
   }
index c65ec20adaab420826969635f21b3e2098fa6825..b2db57adbeb47ee3c00497f9c522c1e9ed6a6386 100644 (file)
@@ -44,13 +44,13 @@ public class NullProfilerTest {
   @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();
 
   }
 }
index 122c292ec615e94897d02e779bd6c679eacd747d..a88a9504b089db9e8da499cd67ac7ab910f55c7d 100644 (file)
@@ -378,8 +378,8 @@ public class MoreCollectorsTest {
 
   @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
@@ -474,8 +474,8 @@ public class MoreCollectorsTest {
 
   @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
@@ -572,7 +572,7 @@ public class MoreCollectorsTest {
   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
index 888b7ea81c73fcb178bb9b659cedbaf526ac53d6..e9b5c82a50f498dccab59981efa6ad5bcfa85032 100644 (file)
@@ -177,7 +177,7 @@ public class DefaultInputFileTest {
     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);
@@ -214,14 +214,14 @@ public class DefaultInputFileTest {
     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);
@@ -277,15 +277,15 @@ public class DefaultInputFileTest {
     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);
@@ -301,7 +301,7 @@ public class DefaultInputFileTest {
     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);
   }
index 00642518985f1dbee1821580ebd1f090278294c6..a1946838ab90761cf34098db6d12114e40c5523a 100644 (file)
@@ -64,7 +64,7 @@ public class FileMetadataTest {
 
     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);
index f4fdc67c8b9ab2f6882370c5221f60a5dfb57902..b9bc7ba5612cd9fa3e076484f32af94d1cccde3a 100644 (file)
@@ -47,9 +47,9 @@ public class DefaultRulesTest {
     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
index 6cf2c86c021b4da2612731c5f0a48943f8cddb0a..0c1014bd09384f7abfc81ab4bc05bf1a994ff445 100644 (file)
@@ -219,7 +219,7 @@ public class MapSettingsTest {
   @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);
   }
 
@@ -471,7 +471,7 @@ public class MapSettingsTest {
 
   @Test
   public void getStringLines_no_value() {
-    Assertions.assertThat(new MapSettings().getStringLines("foo")).hasSize(0);
+    Assertions.assertThat(new MapSettings().getStringLines("foo")).isEmpty();
   }
 
   @Test
@@ -517,7 +517,7 @@ public class MapSettingsTest {
 
     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
index a4f2cc322ee3273b41950078b08ede289cca9c0f..d32a88fb13ce9b4e8d502a3317c530d0297e1c70 100644 (file)
@@ -45,8 +45,8 @@ public class WorkDurationTest {
   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);
 
@@ -58,40 +58,40 @@ public class WorkDurationTest {
   @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
@@ -126,12 +126,12 @@ public class WorkDurationTest {
     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);
@@ -148,15 +148,15 @@ public class WorkDurationTest {
   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);
 
@@ -173,7 +173,7 @@ public class WorkDurationTest {
     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);
   }
 
index 4d9c9a3f6b23fbedc5139c1f894583686454fd16..63b517ab4cd25cda821545bbf21cd96923e8f580 100644 (file)
@@ -33,7 +33,7 @@ public class RangeDistributionBuilderTest {
 
     assertThat(limits[0]).isEqualTo(4);
     assertThat(limits[1]).isEqualTo(2);
-    assertThat(limits[2]).isEqualTo(0);
+    assertThat(limits[2]).isZero();
   }
 
   @Test
index c183a902c6780b02157c990e5d18d80cd0807711..1af1faa142c7d962e5a34ef4b2cda0f3c7d9aab6 100644 (file)
@@ -366,8 +366,8 @@ public class RequestTest {
     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
@@ -427,8 +427,8 @@ public class RequestTest {
     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
index f1258df716f319367487a96e21f8ea5f1f428353..7444240b3bd5f75a12ccbb063c6de9467eb6738b 100644 (file)
@@ -61,7 +61,7 @@ public class TaskDefinitionTest {
     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);
   }
 
index 1281b641b076b7fd469b151102cb66aece33c5cb..f0122c75e0edff597e0f043797f61f9e33cf9b74 100644 (file)
@@ -134,7 +134,7 @@ public class DateUtilsTest {
   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
index c233dadde6d42e0fd26f2668be2541f0d5c72250..d2c43d7fe6a4aeeb6f9711d39067b62d59484fe3 100644 (file)
@@ -38,13 +38,13 @@ public class PagingTest {
     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);
   }
 
index 8c00c020e77781ae34a6941a74793cc2ef328649..e79f1ff72a5049b410857ed107288a5338df3ce3 100644 (file)
@@ -77,8 +77,8 @@ public class VersionTest {
 
   @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);
@@ -88,7 +88,7 @@ public class VersionTest {
 
   @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);
@@ -99,7 +99,7 @@ public class VersionTest {
   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
index a158ec4972a6e13b30a44e76f8739f80c3bf13e1..e758c6ff4681628c84e5811048d6b7d4cf59a2eb 100644 (file)
@@ -62,7 +62,7 @@ public class CommandExecutorTest {
       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();
@@ -103,7 +103,7 @@ public class CommandExecutorTest {
       .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);
index 0b69d4917d4177847b9c2aac119a0da61dcdad47..ac2b3ea5cc21c7b28e42b953e686b661656a6f68 100644 (file)
@@ -107,7 +107,7 @@ public class LoggingConfiguratorTest {
     logger.error(TEST_STR);
     logger.info(TEST_STR);
     logger.debug(TEST_STR);
-    assertThat(out.size()).isEqualTo(0);
+    assertThat(out.size()).isZero();
   }
 
   @Test
index 2878464e325b00839a0b83804ca458967f9cda6d..dd6d43348bde410f97a20e7e4fff7ff0ab0fb24b 100644 (file)
@@ -91,7 +91,7 @@ public class PluginFilesTest {
 
     verifySameContent(result, jar);
     // no requests to server
-    assertThat(server.getRequestCount()).isEqualTo(0);
+    assertThat(server.getRequestCount()).isZero();
   }
 
   @Test
index f8614ce4fcc1d219e7cc025c4a8dc10464ab1f84..88c0f065dfd43f9b94a02df2828f7effa0d64c24 100644 (file)
@@ -275,7 +275,7 @@ public class CpdExecutorTest {
     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);
index 3d845f72376f085812796a207c0f6a0c5bdab19c..46ec1f34b40ade55509fc598c3598220e4e577a9 100644 (file)
@@ -132,7 +132,7 @@ public class ExternalIssueImporterTest {
     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());
   }
index 2737c635d6184c13397e9ad3d2d575f7498ef77a..20d679705c1ffa8750cba18cbee0fad82f0c1f48 100644 (file)
@@ -69,11 +69,11 @@ public class GenericCoverageReportParserTest {
     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
@@ -90,7 +90,7 @@ public class GenericCoverageReportParserTest {
     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)
index cbb6acfb10911e60fe9c73dba2430579824a0655..c1f58c9cb85b60995cd1bbd5dd7deb7499c01421 100644 (file)
@@ -42,7 +42,7 @@ public class IssueExclusionPatternInitializerTest {
   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)
@@ -75,9 +75,9 @@ public class IssueExclusionPatternInitializerTest {
     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)
@@ -98,8 +98,8 @@ public class IssueExclusionPatternInitializerTest {
     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);
   }
 
index df1a9f9f14b0aafbe017d2a3fa574274d3234dda..7c8f2eabaf1fb5bd8ff0e542987386886c84e287 100644 (file)
@@ -277,8 +277,8 @@ public class CoverageMediumTest {
     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();
@@ -351,8 +351,8 @@ public class CoverageMediumTest {
     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();
index bd2e1f3cdd769b620810a7d87c96d47025f55ea0..2400a31d898933884a19c261d2bccd31b28c389b 100644 (file)
@@ -52,8 +52,8 @@ public class GenericCoverageMediumTest {
 
     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();
 
@@ -79,8 +79,8 @@ public class GenericCoverageMediumTest {
 
     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();
 
index b30f7455091541f93f8ebf0896418767f0f7d7ca..2ecec04dea2343fb2b1b9cead65d22c5a6c6c303 100644 (file)
@@ -122,37 +122,25 @@ public class ExternalIssuesMediumTest {
 
     // 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");
@@ -164,9 +152,33 @@ public class ExternalIssuesMediumTest {
     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);
   }
 }
index 64f99bb2ac935400dd97777aff9de3038590253d..c444ce342bdeffd0eedb433c1f3cf6df2eba59a6 100644 (file)
@@ -229,7 +229,7 @@ public class IssuesMediumTest {
     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);
@@ -376,7 +376,7 @@ public class IssuesMediumTest {
     assertThat(issues).hasSize(10);
 
     issues = result.issuesFor(result.inputFile("moduleB/src/sampleB.xoo"));
-    assertThat(issues).hasSize(0);
+    assertThat(issues).isEmpty();
   }
 
   private void activateTODORule() {
index 74bc606295f83238442f1a8526c4c8dfac0392f3..58d31feebf6f93f23991460dc67534b1d0715364 100644 (file)
@@ -124,7 +124,7 @@ public class ComponentsPublisherTest {
     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);
@@ -195,7 +195,7 @@ public class ComponentsPublisherTest {
     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
index 869422802678939e02731a0b44c7ada69424dad4..a123b6656edf01d8989a5d42d79ff0b9e893fdcc 100644 (file)
@@ -87,7 +87,7 @@ public class ByteCharsetDetectorTest {
     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
@@ -96,7 +96,7 @@ public class ByteCharsetDetectorTest {
     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
index 656fb421fb2e73e2caa17f847f1577cbb10922e6..1648a6315fd6a293569c4d2e3a7a2b23c8add448 100644 (file)
@@ -54,7 +54,7 @@ public class MultiModuleProjectRepositoryTest {
 
     repository.addFileDataToModule("module1", null, fileData);
 
-    assertThat(repository.repositoriesByModule()).hasSize(0);
+    assertThat(repository.repositoriesByModule()).isEmpty();
   }
 
   @Test
@@ -63,6 +63,6 @@ public class MultiModuleProjectRepositoryTest {
 
     repository.addFileDataToModule("module2", "/Abc.java", fileData);
 
-    assertThat(repository.repositoriesByModule()).hasSize(0);
+    assertThat(repository.repositoriesByModule()).isEmpty();
   }
 }
index dc34d9f8589e82b9f7ea881bcffd91d0a2201041..6c5f5819f1633b6390f1aee6641be51840298dc4 100644 (file)
@@ -50,7 +50,7 @@ public class SingleProjectRepositoryTest {
 
     repository.addFileData(null, fileData);
 
-    assertThat(repository.fileData()).hasSize(0);
+    assertThat(repository.fileData()).isEmpty();
   }
 
   @Test
@@ -59,6 +59,6 @@ public class SingleProjectRepositoryTest {
 
     repository.addFileData("/Abc.java", fileData);
 
-    assertThat(repository.fileData()).hasSize(0);
+    assertThat(repository.fileData()).isEmpty();
   }
 }