aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2014-02-19 12:28:38 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2014-02-25 18:52:32 +0100
commit23124a18155d030527aa7760b35a0bea5744f9ce (patch)
tree16cbf1b35ca932b177e42b6a4d068704df643cf0 /sonar-plugin-api/src/test
parent0fae2d552337885d31d10348c9900e7ce993dfb4 (diff)
downloadsonarqube-23124a18155d030527aa7760b35a0bea5744f9ce.tar.gz
sonarqube-23124a18155d030527aa7760b35a0bea5744f9ce.zip
SONAR-4996 Update issue debt to seconds (backend + display)
Diffstat (limited to 'sonar-plugin-api/src/test')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java5
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkDurationFactoryTest.java12
2 files changed, 12 insertions, 5 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java
index 0df487f777c..9a88011c3c1 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java
@@ -25,7 +25,6 @@ import org.junit.Test;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.IssueComment;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.WorkDuration;
import java.text.SimpleDateFormat;
import java.util.List;
@@ -50,7 +49,7 @@ public class DefaultIssueTest {
.setMessage("a message")
.setLine(7)
.setEffortToFix(1.2d)
- .setTechnicalDebt(WorkDuration.createFromValueAndUnit(1, WorkDuration.UNIT.DAYS, 8))
+ .setDebt(28800L)
.setActionPlanKey("BCDE")
.setStatus(Issue.STATUS_CLOSED)
.setResolution(Issue.RESOLUTION_FIXED)
@@ -78,7 +77,7 @@ public class DefaultIssueTest {
assertThat(issue.message()).isEqualTo("a message");
assertThat(issue.line()).isEqualTo(7);
assertThat(issue.effortToFix()).isEqualTo(1.2d);
- assertThat(issue.technicalDebt()).isEqualTo(WorkDuration.createFromValueAndUnit(1, WorkDuration.UNIT.DAYS, 8));
+ assertThat(issue.debt()).isEqualTo(28800L);
assertThat(issue.actionPlanKey()).isEqualTo("BCDE");
assertThat(issue.status()).isEqualTo(Issue.STATUS_CLOSED);
assertThat(issue.resolution()).isEqualTo(Issue.RESOLUTION_FIXED);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkDurationFactoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkDurationFactoryTest.java
index 88e21e9a704..ae289085b8f 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkDurationFactoryTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkDurationFactoryTest.java
@@ -41,9 +41,9 @@ public class WorkDurationFactoryTest {
@Test
public void create_from_working_value() throws Exception {
// 1 working day -> 8 hours
- assertThat(factory.createFromWorkingValue(1, WorkDuration.UNIT.DAYS).toSeconds()).isEqualTo(8*60*60);
+ assertThat(factory.createFromWorkingValue(1, WorkDuration.UNIT.DAYS).toSeconds()).isEqualTo(8 * 60 * 60);
// 8 hours
- assertThat(factory.createFromWorkingValue(8, WorkDuration.UNIT.HOURS).toSeconds()).isEqualTo(8*60*60);
+ assertThat(factory.createFromWorkingValue(8, WorkDuration.UNIT.HOURS).toSeconds()).isEqualTo(8 * 60 * 60);
}
@Test
@@ -53,4 +53,12 @@ public class WorkDurationFactoryTest {
assertThat(workDuration.hours()).isEqualTo(0);
assertThat(workDuration.minutes()).isEqualTo(1);
}
+
+ @Test
+ public void create_from_seconds() throws Exception {
+ WorkDuration workDuration = factory.createFromSeconds(8 * 60 * 60L);
+ assertThat(workDuration.days()).isEqualTo(1);
+ assertThat(workDuration.hours()).isEqualTo(0);
+ assertThat(workDuration.minutes()).isEqualTo(0);
+ }
}