diff options
author | David Gageot <david@gageot.net> | 2012-07-18 08:53:57 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-18 08:54:35 +0200 |
commit | fdc4b664a5d841ec80e15c0867d697dc02f2f4cb (patch) | |
tree | acb2667e5ca2a995ec5795a2496839789138cb5a /sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java | |
parent | 7cd84ab05c0610c9faea163be591a64c61958cae (diff) | |
download | sonarqube-fdc4b664a5d841ec80e15c0867d697dc02f2f4cb.tar.gz sonarqube-fdc4b664a5d841ec80e15c0867d697dc02f2f4cb.zip |
Simplify code
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java index d14685681ba..1bb8ba4fd6e 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java @@ -58,7 +58,7 @@ public class MeasureTest { @Test public void persistenceModeIsDatabaseForBigDataMeasures() { Measure bigDataMeasure = new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "long data") - .setPersistenceMode(PersistenceMode.DATABASE); + .setPersistenceMode(PersistenceMode.DATABASE); assertThat(bigDataMeasure.getPersistenceMode()).isEqualTo(PersistenceMode.DATABASE); } @@ -194,4 +194,15 @@ public class MeasureTest { assertThat(measure.hasData()).isFalse(); assertThat(measure.getData()).isNull(); } + + @Test + public void null_value_and_null_variations_should_be_considered_as_best_value() { + assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation1(0.0).isBestValue()).isTrue(); + assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation1(1.0).isBestValue()).isFalse(); + assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation2(1.0).isBestValue()).isFalse(); + assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation3(1.0).isBestValue()).isFalse(); + assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation4(1.0).isBestValue()).isFalse(); + assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation5(1.0).isBestValue()).isFalse(); + } + } |