diff options
author | Pierre <pierre.guillot@sonarsource.com> | 2020-12-11 17:20:41 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-12-14 20:07:14 +0000 |
commit | ffcea568c79640227b2fd9c562f642b9d087ea10 (patch) | |
tree | 6b0c16201bdc6308048744fea48f4e4a9667fd5d /server/sonar-ce-task-projectanalysis | |
parent | 4e07979ccca556d5f05a1be05b88f0bd85ff3f66 (diff) | |
download | sonarqube-ffcea568c79640227b2fd9c562f642b9d087ea10.tar.gz sonarqube-ffcea568c79640227b2fd9c562f642b9d087ea10.zip |
fix code smells
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
15 files changed, 20 insertions, 20 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/MatchesByScoreTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/MatchesByScoreTest.java index ed1f581e66d..7bdd0b3f334 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/MatchesByScoreTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/MatchesByScoreTest.java @@ -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); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/SourceSimilarityImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/SourceSimilarityImplTest.java index d77d7327a76..86eb96a773b 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/SourceSimilarityImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/SourceSimilarityImplTest.java @@ -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(); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/DoubleValueTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/DoubleValueTest.java index 7b5d7fc8008..1da21f2c9d2 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/DoubleValueTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/DoubleValueTest.java @@ -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) { diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/IntValueTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/IntValueTest.java index 339ba5a2909..4fd80d5dbf3 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/IntValueTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/counter/IntValueTest.java @@ -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) { diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/AdHocRuleCreatorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/AdHocRuleCreatorTest.java index 46a427db219..3a1157243be 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/AdHocRuleCreatorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/AdHocRuleCreatorTest.java @@ -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); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java index acad6933890..9554769ed3b 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java @@ -264,7 +264,7 @@ public class IntegrateIssuesVisitorTest { underTest.visitAny(FILE); List<DefaultIssue> issues = newArrayList(protoIssueCache.traverse()); - assertThat(issues).hasSize(0); + assertThat(issues).isEmpty(); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerReferenceBranchInputFactoryTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerReferenceBranchInputFactoryTest.java index 6cf74ec1b74..ee470cf2799 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerReferenceBranchInputFactoryTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerReferenceBranchInputFactoryTest.java @@ -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(); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PostMeasuresComputationChecksStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PostMeasuresComputationChecksStepTest.java index a26fe052f0c..dee477693ab 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PostMeasuresComputationChecksStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PostMeasuresComputationChecksStepTest.java @@ -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 diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/PersistFileSourcesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/PersistFileSourcesStepTest.java index 95ff232ff99..665fa2bc02a 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/PersistFileSourcesStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/PersistFileSourcesStepTest.java @@ -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(); } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/linereader/CoverageLineReaderTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/linereader/CoverageLineReaderTest.java index 2e9cd1d89fe..248aea409e0 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/linereader/CoverageLineReaderTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/linereader/CoverageLineReaderTest.java @@ -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 diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAdHocRulesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAdHocRulesStepTest.java index 2aa58c65beb..5221e2f6a77 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAdHocRulesStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAdHocRulesStepTest.java @@ -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"); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAnalysisPropertiesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAnalysisPropertiesStepTest.java index c1f87990a15..26ce6586c88 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAnalysisPropertiesStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistAnalysisPropertiesStepTest.java @@ -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 diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java index 2175648c8a4..80179632e23 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java @@ -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); } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java index a5c16b02745..655e7f6d217 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java @@ -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) { diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java index 9af840e7d1b..40ea74a013c 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java @@ -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); } |