aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/test/java
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-06 12:15:15 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-06 12:15:22 +0100
commit94ed63a7c64ddebf9056604535e4439a82ceecae (patch)
treeb8a2bb09bc2fe2653e80f8dda358da0795e8a176 /sonar-batch/src/test/java
parent975dacb594135e449c621d254081f6e179ec51c3 (diff)
downloadsonarqube-94ed63a7c64ddebf9056604535e4439a82ceecae.tar.gz
sonarqube-94ed63a7c64ddebf9056604535e4439a82ceecae.zip
SONAR-5056 Create new Durations API to format Duration and convert String to Duration
Diffstat (limited to 'sonar-batch/src/test/java')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java7
1 files changed, 5 insertions, 2 deletions
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 bf1d149df9c..ef894d67851 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
@@ -38,6 +38,7 @@ import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
import org.sonar.api.test.IsMeasure;
import org.sonar.api.utils.Duration;
+import org.sonar.api.utils.Durations;
import org.sonar.core.timemachine.Periods;
import java.util.Locale;
@@ -62,12 +63,14 @@ public class QualityGateVerifierTest {
Snapshot snapshot;
Periods periods;
I18n i18n;
+ Durations durations;
@Before
public void before() {
context = mock(DecoratorContext.class);
periods = mock(Periods.class);
i18n = mock(I18n.class);
+ durations = mock(Durations.class);
when(i18n.message(any(Locale.class), eq("variation"), eq("variation"))).thenReturn("variation");
measureClasses = new Measure(CoreMetrics.CLASSES, 20d);
@@ -80,7 +83,7 @@ public class QualityGateVerifierTest {
snapshot = mock(Snapshot.class);
projectAlerts = new ProjectAlerts();
- verifier = new QualityGateVerifier(snapshot, projectAlerts, periods, i18n);
+ verifier = new QualityGateVerifier(snapshot, projectAlerts, periods, i18n, durations);
project = new Project("foo");
}
@@ -351,7 +354,7 @@ public class QualityGateVerifierTest {
// metric name is declared in l10n bundle
when(i18n.message(any(Locale.class), eq("metric.tech_debt.name"), anyString())).thenReturn("The Debt");
- when(i18n.formatWorkDuration(any(Locale.class), eq(Duration.create(3600L)))).thenReturn("1h");
+ when(durations.format(any(Locale.class), eq(Duration.create(3600L)), eq(Durations.DurationFormat.SHORT))).thenReturn("1h");
when(context.getMeasure(metric)).thenReturn(new Measure(metric, 1800d));
projectAlerts.addAll(Lists.newArrayList(new Alert(null, metric, Alert.OPERATOR_SMALLER, "3600", null)));