aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-11 08:09:01 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-11 08:09:01 +0100
commitdce23fcf9ac907f6621ab0c11c397febff280ebc (patch)
treef819d4a7216d35389a3063b0f0a96cde49cb62db /sonar-plugin-api/src/test
parent1ffa320fb3e44cdaf635678a04c473ca4f348514 (diff)
downloadsonarqube-dce23fcf9ac907f6621ab0c11c397febff280ebc.tar.gz
sonarqube-dce23fcf9ac907f6621ab0c11c397febff280ebc.zip
SONAR-5056 Read debt from rule during analysis
Diffstat (limited to 'sonar-plugin-api/src/test')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java
index cf7eb04d72b..ed99a98301e 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java
@@ -76,6 +76,21 @@ public class DurationTest {
}
@Test
+ public void add() throws Exception {
+ assertThat(Duration.decode("1h", HOURS_IN_DAY).add(Duration.decode("1min", HOURS_IN_DAY))).isEqualTo(Duration.decode("1h1min", HOURS_IN_DAY));
+ }
+
+ @Test
+ public void subtract() throws Exception {
+ assertThat(Duration.decode("1h", HOURS_IN_DAY).subtract(Duration.decode("1min", HOURS_IN_DAY))).isEqualTo(Duration.decode("59min", HOURS_IN_DAY));
+ }
+
+ @Test
+ public void multiply() throws Exception {
+ assertThat(Duration.decode("1h", HOURS_IN_DAY).multiply(2)).isEqualTo(Duration.decode("2h", HOURS_IN_DAY));
+ }
+
+ @Test
public void test_equals_and_hashcode() throws Exception {
Duration duration = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);
Duration durationWithSameValue = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);