aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-07-17 14:48:31 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-07-17 16:01:25 +0200
commit476bdc68a0e83fa504190faeef089a8be0de1341 (patch)
treed5958d1a2edad833234075730f93c74abfcb7b17
parent600f03da4b35ef94cbe9b0aea9544e27325e843a (diff)
downloadsonarqube-476bdc68a0e83fa504190faeef089a8be0de1341.tar.gz
sonarqube-476bdc68a0e83fa504190faeef089a8be0de1341.zip
Rename getNewMeasureXXX by getAddedMeasureXXX
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java24
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java24
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java94
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java24
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepoEntry.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java26
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java110
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java42
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java180
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java36
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/step/SqaleMeasuresStepTest.java8
12 files changed, 296 insertions, 284 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java
index 7c3edbd31a7..e2b79c8dd04 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java
@@ -104,14 +104,14 @@ public class AverageFormulaExecutionTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasure(1, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(3d);
- assertThat(measureRepository.getNewRawMeasure(11, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(2d);
- assertThat(measureRepository.getNewRawMeasure(111, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(2d);
- assertThat(measureRepository.getNewRawMeasure(1111, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(2.5d);
- assertThat(measureRepository.getNewRawMeasure(1112, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(1d);
- assertThat(measureRepository.getNewRawMeasure(12, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(4.5d);
- assertThat(measureRepository.getNewRawMeasure(121, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(4.5d);
- assertThat(measureRepository.getNewRawMeasure(1211, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(4.5d);
+ assertThat(measureRepository.getAddedRawMeasure(1, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(3d);
+ assertThat(measureRepository.getAddedRawMeasure(11, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(2d);
+ assertThat(measureRepository.getAddedRawMeasure(111, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(2d);
+ assertThat(measureRepository.getAddedRawMeasure(1111, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(2.5d);
+ assertThat(measureRepository.getAddedRawMeasure(1112, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(1d);
+ assertThat(measureRepository.getAddedRawMeasure(12, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(4.5d);
+ assertThat(measureRepository.getAddedRawMeasure(121, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(4.5d);
+ assertThat(measureRepository.getAddedRawMeasure(1211, FUNCTION_COMPLEXITY_KEY).get().getDoubleValue()).isEqualTo(4.5d);
}
@Test
@@ -131,10 +131,10 @@ public class AverageFormulaExecutionTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(11)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(111)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(1111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(11)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1111)).isEmpty();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java
index e4bc9a192c5..181ca32d4d3 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java
@@ -86,14 +86,14 @@ public class DistributionFormulaExecutionTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasure(1, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=4;3.5=10;6.5=12");
- assertThat(measureRepository.getNewRawMeasure(11, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=3;3.5=7;6.5=10");
- assertThat(measureRepository.getNewRawMeasure(111, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=3;3.5=7;6.5=10");
- assertThat(measureRepository.getNewRawMeasures(1111)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(1112)).isEmpty();
- assertThat(measureRepository.getNewRawMeasure(12, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=1;3.5=3;6.5=2");
- assertThat(measureRepository.getNewRawMeasure(121, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=1;3.5=3;6.5=2");
- assertThat(measureRepository.getNewRawMeasures(1211)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasure(1, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=4;3.5=10;6.5=12");
+ assertThat(measureRepository.getAddedRawMeasure(11, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=3;3.5=7;6.5=10");
+ assertThat(measureRepository.getAddedRawMeasure(111, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=3;3.5=7;6.5=10");
+ assertThat(measureRepository.getAddedRawMeasures(1111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1112)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasure(12, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=1;3.5=3;6.5=2");
+ assertThat(measureRepository.getAddedRawMeasure(121, FUNCTION_COMPLEXITY_DISTRIBUTION_KEY).get().getStringValue()).isEqualTo("0.5=1;3.5=3;6.5=2");
+ assertThat(measureRepository.getAddedRawMeasures(1211)).isEmpty();
}
@Test
@@ -113,10 +113,10 @@ public class DistributionFormulaExecutionTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(11)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(111)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(1111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(11)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1111)).isEmpty();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java
index 9b4a9add2f8..55d1a9aecde 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java
@@ -96,14 +96,14 @@ public class FormulaExecutorComponentVisitorTest {
underTest.visit(BALANCED_COMPONENT_TREE);
- assertThat(measureRepository.getNewRawMeasure(1, NCLOC_KEY).get().getIntValue()).isEqualTo(20);
- assertThat(measureRepository.getNewRawMeasure(11, NCLOC_KEY).get().getIntValue()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasure(111, NCLOC_KEY).get().getIntValue()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasure(1111, NCLOC_KEY).get().getIntValue()).isEqualTo(10);
- assertThat(measureRepository.getNewRawMeasure(1112, NCLOC_KEY).get().getIntValue()).isEqualTo(8);
- assertThat(measureRepository.getNewRawMeasure(12, NCLOC_KEY).get().getIntValue()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasure(121, NCLOC_KEY).get().getIntValue()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasure(1211, NCLOC_KEY).get().getIntValue()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(1, NCLOC_KEY).get().getIntValue()).isEqualTo(20);
+ assertThat(measureRepository.getAddedRawMeasure(11, NCLOC_KEY).get().getIntValue()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasure(111, NCLOC_KEY).get().getIntValue()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasure(1111, NCLOC_KEY).get().getIntValue()).isEqualTo(10);
+ assertThat(measureRepository.getAddedRawMeasure(1112, NCLOC_KEY).get().getIntValue()).isEqualTo(8);
+ assertThat(measureRepository.getAddedRawMeasure(12, NCLOC_KEY).get().getIntValue()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(121, NCLOC_KEY).get().getIntValue()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(1211, NCLOC_KEY).get().getIntValue()).isEqualTo(2);
}
@Test
@@ -119,22 +119,22 @@ public class FormulaExecutorComponentVisitorTest {
.buildFor(ImmutableList.<Formula>of(new FakeMultiMetricFormula()));
underTest.visit(BALANCED_COMPONENT_TREE);
- assertThat(measureRepository.getNewRawMeasure(1, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(30);
- assertThat(measureRepository.getNewRawMeasure(1, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(120);
- assertThat(measureRepository.getNewRawMeasure(11, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(28);
- assertThat(measureRepository.getNewRawMeasure(11, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(118);
- assertThat(measureRepository.getNewRawMeasure(111, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(28);
- assertThat(measureRepository.getNewRawMeasure(111, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(118);
- assertThat(measureRepository.getNewRawMeasure(1111, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(20);
- assertThat(measureRepository.getNewRawMeasure(1111, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(110);
- assertThat(measureRepository.getNewRawMeasure(1112, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasure(1112, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(108);
- assertThat(measureRepository.getNewRawMeasure(12, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(12);
- assertThat(measureRepository.getNewRawMeasure(12, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(102);
- assertThat(measureRepository.getNewRawMeasure(121, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(12);
- assertThat(measureRepository.getNewRawMeasure(121, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(102);
- assertThat(measureRepository.getNewRawMeasure(1211, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(12);
- assertThat(measureRepository.getNewRawMeasure(1211, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(102);
+ assertThat(measureRepository.getAddedRawMeasure(1, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(30);
+ assertThat(measureRepository.getAddedRawMeasure(1, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(120);
+ assertThat(measureRepository.getAddedRawMeasure(11, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(28);
+ assertThat(measureRepository.getAddedRawMeasure(11, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(118);
+ assertThat(measureRepository.getAddedRawMeasure(111, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(28);
+ assertThat(measureRepository.getAddedRawMeasure(111, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(118);
+ assertThat(measureRepository.getAddedRawMeasure(1111, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(20);
+ assertThat(measureRepository.getAddedRawMeasure(1111, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(110);
+ assertThat(measureRepository.getAddedRawMeasure(1112, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasure(1112, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(108);
+ assertThat(measureRepository.getAddedRawMeasure(12, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(12);
+ assertThat(measureRepository.getAddedRawMeasure(12, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(102);
+ assertThat(measureRepository.getAddedRawMeasure(121, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(12);
+ assertThat(measureRepository.getAddedRawMeasure(121, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(102);
+ assertThat(measureRepository.getAddedRawMeasure(1211, NEW_LINES_TO_COVER_KEY).get().getIntValue()).isEqualTo(12);
+ assertThat(measureRepository.getAddedRawMeasure(1211, NEW_IT_COVERAGE_KEY).get().getIntValue()).isEqualTo(102);
}
@Test
@@ -147,22 +147,22 @@ public class FormulaExecutorComponentVisitorTest {
underTest.visit(BALANCED_COMPONENT_TREE);
- assertThat(measureRepository.getNewRawMeasure(1, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(20);
- assertThat(measureRepository.getNewRawMeasure(1, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(40);
- assertThat(measureRepository.getNewRawMeasure(11, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasure(11, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(36);
- assertThat(measureRepository.getNewRawMeasure(111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasure(111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(36);
- assertThat(measureRepository.getNewRawMeasure(1111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(10);
- assertThat(measureRepository.getNewRawMeasure(1111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(20);
- assertThat(measureRepository.getNewRawMeasure(1112, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(8);
- assertThat(measureRepository.getNewRawMeasure(1112, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(16);
- assertThat(measureRepository.getNewRawMeasure(12, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasure(12, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(4);
- assertThat(measureRepository.getNewRawMeasure(121, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasure(121, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(4);
- assertThat(measureRepository.getNewRawMeasure(1211, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasure(1211, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(4);
+ assertThat(measureRepository.getAddedRawMeasure(1, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(20);
+ assertThat(measureRepository.getAddedRawMeasure(1, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(40);
+ assertThat(measureRepository.getAddedRawMeasure(11, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasure(11, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(36);
+ assertThat(measureRepository.getAddedRawMeasure(111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasure(111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(36);
+ assertThat(measureRepository.getAddedRawMeasure(1111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(10);
+ assertThat(measureRepository.getAddedRawMeasure(1111, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(20);
+ assertThat(measureRepository.getAddedRawMeasure(1112, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(8);
+ assertThat(measureRepository.getAddedRawMeasure(1112, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(16);
+ assertThat(measureRepository.getAddedRawMeasure(12, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(12, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(4);
+ assertThat(measureRepository.getAddedRawMeasure(121, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(121, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(4);
+ assertThat(measureRepository.getAddedRawMeasure(1211, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation2()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(1211, NEW_IT_COVERAGE_KEY).get().getVariations().getVariation5()).isEqualTo(4);
}
private static Measure createMeasureWithVariation(double variation2Value, double variation5Value) {
@@ -185,10 +185,10 @@ public class FormulaExecutorComponentVisitorTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(11)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(111)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(1111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(11)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1111)).isEmpty();
}
@Test
@@ -204,9 +204,9 @@ public class FormulaExecutorComponentVisitorTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(11)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(11)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(111)).isEmpty();
}
private class FakeFormula implements Formula<FakeCounter> {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java
index 28f9a5a222a..56d2ad7aebf 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java
@@ -86,14 +86,14 @@ public class SumFormulaExecutionTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasure(1, LINES_KEY).get().getIntValue()).isEqualTo(20);
- assertThat(measureRepository.getNewRawMeasure(11, LINES_KEY).get().getIntValue()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasure(111, LINES_KEY).get().getIntValue()).isEqualTo(18);
- assertThat(measureRepository.getNewRawMeasures(1111)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(1112)).isEmpty();
- assertThat(measureRepository.getNewRawMeasure(12, LINES_KEY).get().getIntValue()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasure(121, LINES_KEY).get().getIntValue()).isEqualTo(2);
- assertThat(measureRepository.getNewRawMeasures(1211)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasure(1, LINES_KEY).get().getIntValue()).isEqualTo(20);
+ assertThat(measureRepository.getAddedRawMeasure(11, LINES_KEY).get().getIntValue()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasure(111, LINES_KEY).get().getIntValue()).isEqualTo(18);
+ assertThat(measureRepository.getAddedRawMeasures(1111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1112)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasure(12, LINES_KEY).get().getIntValue()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasure(121, LINES_KEY).get().getIntValue()).isEqualTo(2);
+ assertThat(measureRepository.getAddedRawMeasures(1211)).isEmpty();
}
@Test
@@ -113,10 +113,10 @@ public class SumFormulaExecutionTest {
underTest.visit(project);
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(11)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(111)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(1111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(11)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(111)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1111)).isEmpty();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepoEntry.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepoEntry.java
index a5cd825c917..89daa3d717f 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepoEntry.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepoEntry.java
@@ -33,7 +33,7 @@ import org.sonar.server.computation.component.Component;
/**
* This class represents a metric key and an associated measure.
* It can be used to easily compare the content of the SetMultimap returned by {@link MeasureRepository#getRawMeasures(Component)}
- * or {@link MeasureRepositoryRule#getNewRawMeasures(int)}.
+ * or {@link MeasureRepositoryRule#getAddedRawMeasures(int)}.
* <p>
* This class is also highly useful to accurately make sure of the SetMultimap content since this
* object implements a deep equals of Measure objects (see {@link #deepEquals(Measure, Measure)}), when
@@ -43,7 +43,7 @@ import org.sonar.server.computation.component.Component;
* In order to explore the content of the SetMultimap, use {@link #toEntries(SetMultimap)} to convert it
* to an Iterable of {@link MeasureRepoEntry} and then take benefit of AssertJ API, eg.:
* <pre>
- * assertThat(MeasureRepoEntry.toEntries(measureRepository.getNewRawMeasures(componentRef))).containsOnly(
+ * assertThat(MeasureRepoEntry.toEntries(measureRepository.getAddedRawMeasures(componentRef))).containsOnly(
* MeasureRepoEntry.entryOf(DEVELOPMENT_COST_KEY, newMeasureBuilder().create(Long.toString(expectedDevCost))),
* MeasureRepoEntry.entryOf(SQALE_DEBT_RATIO_KEY, newMeasureBuilder().create(expectedDebtRatio))
* );
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
index b1e30387e1b..e3ab287dc6d 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
@@ -60,7 +60,7 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
private final Map<InternalKey, Measure> baseMeasures = new HashMap<>();
private final Map<InternalKey, Measure> rawMeasures = new HashMap<>();
private final Map<InternalKey, Measure> initialRawMeasures = new HashMap<>();
- private final Predicate<Map.Entry<InternalKey, Measure>> isNewMeasure = new Predicate<Map.Entry<InternalKey, Measure>>() {
+ private final Predicate<Map.Entry<InternalKey, Measure>> isAddedMeasure = new Predicate<Map.Entry<InternalKey, Measure>>() {
@Override
public boolean apply(@Nonnull Map.Entry<InternalKey, Measure> input) {
return !initialRawMeasures.containsKey(input.getKey())
@@ -128,16 +128,24 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
return getRawMeasures(componentProvider.getByRef(componentRef));
}
- public SetMultimap<String, Measure> getNewRawMeasures(int componentRef) {
+ /**
+ * Return measures that were added by the step (using {@link #add(Component, Metric, Measure)}).
+ * It does not contain the one added in the test by {@link #addRawMeasure(int, String, Measure)}
+ */
+ public SetMultimap<String, Measure> getAddedRawMeasures(int componentRef) {
checkAndInitProvidersState();
- return getNewRawMeasures(componentProvider.getByRef(componentRef));
+ return getAddedRawMeasures(componentProvider.getByRef(componentRef));
}
- public Optional<Measure> getNewRawMeasure(int componentRef, String metricKey) {
+ /**
+ * Return a measure that were added by the step (using {@link #add(Component, Metric, Measure)}).
+ * It does not contain the one added in the test by {@link #addRawMeasure(int, String, Measure)}
+ */
+ public Optional<Measure> getAddedRawMeasure(int componentRef, String metricKey) {
checkAndInitProvidersState();
- Set<Measure> measures = getNewRawMeasures(componentProvider.getByRef(componentRef)).get(metricKey);
+ Set<Measure> measures = getAddedRawMeasures(componentProvider.getByRef(componentRef)).get(metricKey);
if (measures.isEmpty()) {
return Optional.absent();
} else if (measures.size() != 1) {
@@ -146,11 +154,15 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
return Optional.of(measures.iterator().next());
}
- public SetMultimap<String, Measure> getNewRawMeasures(Component component) {
+ /**
+ * Return measures that were added by the step (using {@link #add(Component, Metric, Measure)}).
+ * It does not contain the one added in the test by {@link #addRawMeasure(int, String, Measure)}
+ */
+ public SetMultimap<String, Measure> getAddedRawMeasures(Component component) {
checkAndInitProvidersState();
ImmutableSetMultimap.Builder<String, Measure> builder = ImmutableSetMultimap.builder();
- for (Map.Entry<InternalKey, Measure> entry : from(filterKeys(rawMeasures, hasComponentRef(component)).entrySet()).filter(isNewMeasure)) {
+ for (Map.Entry<InternalKey, Measure> entry : from(filterKeys(rawMeasures, hasComponentRef(component)).entrySet()).filter(isAddedMeasure)) {
builder.put(entry.getKey().getMetricKey(), entry.getValue());
}
return builder.build();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java
index f4ea3f57351..e2bb500a23b 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java
@@ -102,13 +102,13 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, COMMENT_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, COMMENT_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasures(ROOT_REF).get(COMMENT_LINES_KEY)).containsOnly(newMeasureBuilder().create(500));
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, COMMENT_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, COMMENT_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, COMMENT_LINES_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasures(ROOT_REF).get(COMMENT_LINES_KEY)).containsOnly(newMeasureBuilder().create(500));
}
@Test
@@ -128,12 +128,12 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(60d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(60d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(40d);
}
@Test
@@ -153,12 +153,12 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, COMMENT_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
}
@Test
@@ -216,12 +216,12 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, PUBLIC_API_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, PUBLIC_API_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, PUBLIC_API_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, PUBLIC_API_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, PUBLIC_API_KEY).get().getIntValue()).isEqualTo(500);
}
@Test
@@ -231,12 +231,12 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, PUBLIC_UNDOCUMENTED_API_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, PUBLIC_UNDOCUMENTED_API_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, PUBLIC_UNDOCUMENTED_API_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, PUBLIC_UNDOCUMENTED_API_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, PUBLIC_UNDOCUMENTED_API_KEY).get().getIntValue()).isEqualTo(500);
}
@@ -250,12 +250,12 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(50d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(75d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(50d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(75d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(70d);
}
@Test
@@ -301,32 +301,32 @@ public class CommentMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, PUBLIC_DOCUMENTED_API_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
}
@Test
public void compute_nothing_when_no_data() {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasures(FILE_1_REF)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(FILE_2_REF)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(DIRECTORY_REF)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(SUB_MODULE_REF)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(MODULE_REF)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(ROOT_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_1_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_2_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(DIRECTORY_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(SUB_MODULE_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(MODULE_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(ROOT_REF)).isEmpty();
}
private void assertNoNewMeasures(String metric) {
- assertThat(measureRepository.getNewRawMeasures(FILE_1_REF).get(metric)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(FILE_2_REF).get(metric)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(DIRECTORY_REF).get(metric)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(SUB_MODULE_REF).get(metric)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(MODULE_REF).get(metric)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(ROOT_REF).get(metric)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_1_REF).get(metric)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_2_REF).get(metric)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(DIRECTORY_REF).get(metric)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(SUB_MODULE_REF).get(metric)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(MODULE_REF).get(metric)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(ROOT_REF).get(metric)).isEmpty();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java
index 53fe54776f7..3b174127a27 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java
@@ -83,7 +83,7 @@ public class ComputeQProfileMeasureStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasures(1).get(QUALITY_PROFILES_KEY)).extracting("data").containsOnly(toJson(qp));
+ assertThat(measureRepository.getAddedRawMeasures(1).get(QUALITY_PROFILES_KEY)).extracting("data").containsOnly(toJson(qp));
}
@Test
@@ -107,7 +107,7 @@ public class ComputeQProfileMeasureStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasures(1).get(QUALITY_PROFILES_KEY)).extracting("data").containsOnly(toJson(qp1, qp2));
+ assertThat(measureRepository.getAddedRawMeasures(1).get(QUALITY_PROFILES_KEY)).extracting("data").containsOnly(toJson(qp1, qp2));
}
@Test
@@ -125,7 +125,7 @@ public class ComputeQProfileMeasureStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
}
@Test
@@ -139,7 +139,7 @@ public class ComputeQProfileMeasureStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasures(1)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(1)).isEmpty();
}
private static QualityProfile createQProfile(String qpName, String languageKey) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java
index 1dc40da54a5..edeedaab920 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java
@@ -192,31 +192,31 @@ public class CoverageMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(98.8d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(99d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(97d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(98.8d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(99d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(97d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(91d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(90d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(91d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(90d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasures(UNIT_TEST_FILE_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(UNIT_TEST_FILE_REF)).isEmpty();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, codeCoverageKey).get().getDoubleValue()).isEqualTo(95.5d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, lineCoverageKey).get().getDoubleValue()).isEqualTo(95.4d, DEFAULT_OFFSET);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, branchCoverageKey).get().getDoubleValue()).isEqualTo(96.4d, DEFAULT_OFFSET);
}
@Test
@@ -285,7 +285,7 @@ public class CoverageMeasuresStepTest {
checkMeasureVariations(FILE_2_REF, lineCoverageKey, null, 90d, null, null, 99d);
checkMeasureVariations(FILE_2_REF, branchCoverageKey, null, 96d, null, null, 97d);
- assertThat(measureRepository.getNewRawMeasures(UNIT_TEST_FILE_REF)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(UNIT_TEST_FILE_REF)).isEmpty();
checkMeasureVariations(DIRECTORY_REF, codeCoverageKey, null, 95.5d, null, null, 95.5d);
checkMeasureVariations(DIRECTORY_REF, lineCoverageKey, null, 95.4d, null, null, 95.4d);
@@ -309,7 +309,7 @@ public class CoverageMeasuresStepTest {
}
private void checkMeasureVariations(int fileRef, String metricKey, Double... expectedVariations) {
- Optional<Measure> measure = measureRepository.getNewRawMeasure(fileRef, metricKey);
+ Optional<Measure> measure = measureRepository.getAddedRawMeasure(fileRef, metricKey);
if (measure.isPresent()) {
MeasureVariations measureVariations = measure.get().getVariations();
for (int i = 0; i < expectedVariations.length - 1; i++) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java
index 2ada4aa1a77..39ff993c65e 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java
@@ -103,12 +103,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(50);
}
@Test
@@ -118,24 +118,24 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
}
@Test
public void aggregate_zero_duplicated_blocks_when_no_data() {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_BLOCKS_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_BLOCKS_KEY).get().getIntValue()).isEqualTo(0);
}
@Test
@@ -145,12 +145,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_FILES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_FILES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_FILES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_FILES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(50);
}
@Test
@@ -160,24 +160,24 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_FILES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_FILES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_FILES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_FILES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
}
@Test
public void aggregate_zero_duplicated_files_when_no_data() {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_FILES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_FILES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_FILES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_FILES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_FILES_KEY).get().getIntValue()).isEqualTo(0);
}
@Test
@@ -187,12 +187,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(50);
}
@Test
@@ -202,24 +202,24 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
}
@Test
public void aggregate_zero_duplicated_line_when_no_data() {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_KEY)).isAbsent();
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_KEY)).isAbsent();
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_KEY).get().getIntValue()).isEqualTo(0);
}
@Test
@@ -236,12 +236,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(7.5d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(7.5d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
}
@Test
@@ -265,12 +265,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(7.5d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(7.5d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
}
@Test
@@ -287,12 +287,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(7.5d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(20d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(7.5d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(10d);
}
@Test
@@ -316,12 +316,12 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(0d);
}
@Test
@@ -373,21 +373,21 @@ public class DuplicationMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
- assertThat(measureRepository.getNewRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_1_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_2_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(DIRECTORY_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(SUB_MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(MODULE_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
+ assertThat(measureRepository.getAddedRawMeasure(ROOT_REF, DUPLICATED_LINES_DENSITY_KEY).get().getDoubleValue()).isEqualTo(100d);
}
private void assertNoNewMeasures(String metricKey){
- assertThat(measureRepository.getNewRawMeasures(FILE_1_REF).get(metricKey)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(FILE_2_REF).get(metricKey)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(DIRECTORY_REF).get(metricKey)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(SUB_MODULE_REF).get(metricKey)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(MODULE_REF).get(metricKey)).isEmpty();
- assertThat(measureRepository.getNewRawMeasures(ROOT_REF).get(metricKey)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_1_REF).get(metricKey)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_2_REF).get(metricKey)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(DIRECTORY_REF).get(metricKey)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(SUB_MODULE_REF).get(metricKey)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(MODULE_REF).get(metricKey)).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(ROOT_REF).get(metricKey)).isEmpty();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java
index 299e2524de0..929673959a2 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java
@@ -216,7 +216,7 @@ public class NewCoverageMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasures(FILE_COMPONENT.getRef())).isEmpty();
+ assertThat(measureRepository.getAddedRawMeasures(FILE_COMPONENT.getRef())).isEmpty();
}
@Test
@@ -294,17 +294,17 @@ public class NewCoverageMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newLinesToCover).get().getVariations().getVariation2()).isEqualTo(2d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newLinesToCover).get().getVariations().hasVariation5()).isFalse();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newLinesToCover).get().getVariations().getVariation2()).isEqualTo(2d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newLinesToCover).get().getVariations().hasVariation5()).isFalse();
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newUncoveredLines).get().getVariations().getVariation2()).isEqualTo(1d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newUncoveredLines).get().getVariations().hasVariation5()).isFalse();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newUncoveredLines).get().getVariations().getVariation2()).isEqualTo(1d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newUncoveredLines).get().getVariations().hasVariation5()).isFalse();
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newConditionsToCover).get().getVariations().getVariation2()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newConditionsToCover).get().getVariations().hasVariation5()).isFalse();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newConditionsToCover).get().getVariations().getVariation2()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newConditionsToCover).get().getVariations().hasVariation5()).isFalse();
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newUncoveredConditions).get().getVariations().getVariation2()).isEqualTo(0d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), newUncoveredConditions).get().getVariations().hasVariation5()).isFalse();
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newUncoveredConditions).get().getVariations().getVariation2()).isEqualTo(0d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), newUncoveredConditions).get().getVariations().hasVariation5()).isFalse();
}
@Test
@@ -481,17 +481,17 @@ public class NewCoverageMeasuresStepTest {
underTest.execute();
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newLinesToCover).get().getVariations().getVariation2()).isEqualTo(5d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newLinesToCover).get().getVariations().getVariation5()).isEqualTo(3d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newLinesToCover).get().getVariations().getVariation2()).isEqualTo(5d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newLinesToCover).get().getVariations().getVariation5()).isEqualTo(3d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredLines).get().getVariations().getVariation2()).isEqualTo(3d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredLines).get().getVariations().getVariation5()).isEqualTo(2d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredLines).get().getVariations().getVariation2()).isEqualTo(3d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredLines).get().getVariations().getVariation5()).isEqualTo(2d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newConditionsToCover).get().getVariations().getVariation2()).isEqualTo(7d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newConditionsToCover).get().getVariations().getVariation5()).isEqualTo(3d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newConditionsToCover).get().getVariations().getVariation2()).isEqualTo(7d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newConditionsToCover).get().getVariations().getVariation5()).isEqualTo(3d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredConditions).get().getVariations().getVariation2()).isEqualTo(4d);
- assertThat(measureRepository.getNewRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredConditions).get().getVariations().getVariation5()).isEqualTo(1d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredConditions).get().getVariations().getVariation2()).isEqualTo(4d);
+ assertThat(measureRepository.getAddedRawMeasure(FILE_COMPONENT.getRef(), metricKeys.newUncoveredConditions).get().getVariations().getVariation5()).isEqualTo(1d);
}
private static Measure createMeasure(@Nullable Double variationPeriod2, @Nullable Double variationPeriod5) {
@@ -508,7 +508,7 @@ public class NewCoverageMeasuresStepTest {
}
private void checkMeasureVariations(int fileRef, String metricKey, Double... expectedVariations) {
- Optional<Measure> measure = measureRepository.getNewRawMeasure(fileRef, metricKey);
+ Optional<Measure> measure = measureRepository.getAddedRawMeasure(fileRef, metricKey);
if (measure.isPresent()) {
MeasureVariations measureVariations = measure.get().getVariations();
for (int i = 0; i < expectedVariations.length - 1; i++) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SqaleMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SqaleMeasuresStepTest.java
index 61a4d8287f0..1f2ab2925e9 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SqaleMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SqaleMeasuresStepTest.java
@@ -227,10 +227,10 @@ public class SqaleMeasuresStepTest {
}
private void verifyComponentMeasures(int componentRef, long expectedDevCost, double expectedDebtRatio, SqaleRatingGrid.SqaleRating expectedRating) {
- assertThat(measureRepository.getNewRawMeasure(componentRef, DEVELOPMENT_COST_KEY).get().getStringValue()).isEqualTo(Long.toString(expectedDevCost));
- assertThat(measureRepository.getNewRawMeasure(componentRef, SQALE_DEBT_RATIO_KEY).get().getDoubleValue()).isEqualTo(expectedDebtRatio * 100d, Offset.offset(0.1d));
- assertThat(measureRepository.getNewRawMeasure(componentRef, SQALE_RATING_KEY).get().getIntValue()).isEqualTo(expectedRating.getIndex());
- assertThat(measureRepository.getNewRawMeasure(componentRef, SQALE_RATING_KEY).get().getData()).isEqualTo(expectedRating.name());
+ assertThat(measureRepository.getAddedRawMeasure(componentRef, DEVELOPMENT_COST_KEY).get().getStringValue()).isEqualTo(Long.toString(expectedDevCost));
+ assertThat(measureRepository.getAddedRawMeasure(componentRef, SQALE_DEBT_RATIO_KEY).get().getDoubleValue()).isEqualTo(expectedDebtRatio * 100d, Offset.offset(0.1d));
+ assertThat(measureRepository.getAddedRawMeasure(componentRef, SQALE_RATING_KEY).get().getIntValue()).isEqualTo(expectedRating.getIndex());
+ assertThat(measureRepository.getAddedRawMeasure(componentRef, SQALE_RATING_KEY).get().getData()).isEqualTo(expectedRating.name());
}
}