diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-04-23 16:57:30 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-04-23 17:33:11 +0200 |
commit | ebad62de4864fa13b8f30e766cc6501e3b5ac04f (patch) | |
tree | 78b94066b9bf04c12623c72c650b20b71012223e /sonar-batch | |
parent | b131f3d7faae41ae931f522b4ae208c69aab5dee (diff) | |
download | sonarqube-ebad62de4864fa13b8f30e766cc6501e3b5ac04f.tar.gz sonarqube-ebad62de4864fa13b8f30e766cc6501e3b5ac04f.zip |
SONAR-5148 Allow selection of periods 4 and 5 for quality gate conditions
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/qualitygate/ConditionUtils.java | 4 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/ConditionUtils.java b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/ConditionUtils.java index f2e5b36bbe2..7515efc5b5a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/ConditionUtils.java +++ b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/ConditionUtils.java @@ -188,6 +188,10 @@ class ConditionUtils { return measure.getVariation2(); } else if (period == 3) { return measure.getVariation3(); + } else if (period == 4) { + return measure.getVariation4(); + } else if (period == 5) { + return measure.getVariation5(); } else { throw new IllegalStateException("Following index period is not allowed : " + Double.toString(period)); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java index 21a0550c6ff..1a4be071193 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java @@ -302,8 +302,8 @@ public class QualityGateVerifierTest { verify(context).saveMeasure(argThat(hasLevel(measureRatingMetric, Metric.Level.OK))); } - @Test(expected = IllegalStateException.class) - public void shouldAllowOnlyVariationPeriodOneGlobalPeriods() { + @Test + public void shouldAllowVariationPeriodOnAllPeriods() { measureClasses.setVariation4(40d); ArrayList<ResolvedCondition> conditions = Lists.newArrayList( @@ -312,6 +312,9 @@ public class QualityGateVerifierTest { when(qualityGate.conditions()).thenReturn(conditions); verifier.decorate(project, context); + + verify(context).saveMeasure(argThat(matchesMetric(CoreMetrics.ALERT_STATUS, Metric.Level.WARN, null))); + verify(context).saveMeasure(argThat(hasLevel(measureClasses, Metric.Level.WARN))); } @Test(expected = NotImplementedException.class) |