aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server/src/test/java')
-rw-r--r--sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java3
-rw-r--r--sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogFormatterTest.java7
-rw-r--r--sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java9
-rw-r--r--sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java11
4 files changed, 20 insertions, 10 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java b/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java
index f35b8b0cd7f..33c965d5113 100644
--- a/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java
@@ -33,6 +33,7 @@ import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.rules.Rule;
import org.sonar.api.user.User;
import org.sonar.api.user.UserFinder;
+import org.sonar.api.utils.Duration;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.issue.DefaultActionPlan;
import org.sonar.core.issue.db.IssueChangeDao;
@@ -333,7 +334,7 @@ public class
assertThat(results.issues()).hasSize(1);
DefaultIssue result = (DefaultIssue) results.issues().iterator().next();
- assertThat(result.debt()).isEqualTo(10L);
+ assertThat(result.debt()).isEqualTo(Duration.create(10L));
}
}
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogFormatterTest.java b/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogFormatterTest.java
index 1dcb81c46c7..98323c582b6 100644
--- a/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogFormatterTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogFormatterTest.java
@@ -26,6 +26,7 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.sonar.api.i18n.I18n;
import org.sonar.api.issue.internal.FieldDiffs;
+import org.sonar.api.utils.Duration;
import java.util.List;
import java.util.Locale;
@@ -127,8 +128,8 @@ public class IssueChangelogFormatterTest {
FieldDiffs diffs = new FieldDiffs();
diffs.setDiff("technicalDebt", "18000", "28800");
- when(i18n.formatWorkDuration(any(Locale.class), eq(18000L))).thenReturn("5 hours");
- when(i18n.formatWorkDuration(any(Locale.class), eq(28800L))).thenReturn("1 days");
+ when(i18n.formatWorkDuration(any(Locale.class), eq(Duration.create(18000L)))).thenReturn("5 hours");
+ when(i18n.formatWorkDuration(any(Locale.class), eq(Duration.create(28800L)))).thenReturn("1 days");
when(i18n.message(DEFAULT_LOCALE, "issue.changelog.field.technicalDebt", null)).thenReturn("Technical Debt");
when(i18n.message(DEFAULT_LOCALE, "issue.changelog.changed_to", null, "Technical Debt", "1 days")).thenReturn("Technical Debt changed to 1 days");
@@ -145,7 +146,7 @@ public class IssueChangelogFormatterTest {
FieldDiffs diffs = new FieldDiffs();
diffs.setDiff("technicalDebt", null, "28800");
- when(i18n.formatWorkDuration(any(Locale.class), eq(28800L))).thenReturn("1 days");
+ when(i18n.formatWorkDuration(any(Locale.class), eq(Duration.create(28800L)))).thenReturn("1 days");
when(i18n.message(DEFAULT_LOCALE, "issue.changelog.field.technicalDebt", null)).thenReturn("Technical Debt");
when(i18n.message(DEFAULT_LOCALE, "issue.changelog.changed_to", null, "Technical Debt", "1 days")).thenReturn("Technical Debt changed to 1 days");
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java b/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java
index cf27de1d585..2dc944f5534 100644
--- a/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java
@@ -42,6 +42,7 @@ import org.sonar.api.technicaldebt.server.Characteristic;
import org.sonar.api.technicaldebt.server.internal.DefaultCharacteristic;
import org.sonar.api.user.User;
import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.Duration;
import org.sonar.api.web.UserRole;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.issue.DefaultActionPlan;
@@ -302,11 +303,11 @@ public class IssueShowWsHandlerTest {
@Test
public void show_issue_with_technical_debt() throws Exception {
- Long technicalDebt = 7260L;
- Issue issue = createStandardIssue().setDebt(technicalDebt);
+ Duration debt = (Duration.create(7260L));
+ Issue issue = createStandardIssue().setDebt(debt);
issues.add(issue);
- when(i18n.formatWorkDuration(any(Locale.class), eq(technicalDebt))).thenReturn("2 hours 1 minutes");
+ when(i18n.formatWorkDuration(any(Locale.class), eq(debt))).thenReturn("2 hours 1 minutes");
MockUserSession.set();
WsTester.TestRequest request = tester.newRequest("show").setParam("key", issue.key());
@@ -315,7 +316,7 @@ public class IssueShowWsHandlerTest {
@Test
public void show_issue_with_characteristics() throws Exception {
- Issue issue = createStandardIssue().setDebt(7260L);
+ Issue issue = createStandardIssue().setDebt(Duration.create(7260L));
issues.add(issue);
Characteristic requirement = new DefaultCharacteristic().setId(5).setParentId(2).setRootId(1);
diff --git a/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java b/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java
index 1060704e119..ef26d5c0209 100644
--- a/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java
@@ -25,6 +25,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.sonar.api.i18n.I18n;
+import org.sonar.api.utils.Duration;
import org.sonar.core.i18n.GwtI18n;
import java.util.Date;
@@ -94,8 +95,14 @@ public class JRubyI18nTest {
@Test
public void format_work_duration() throws Exception {
- jRubyI18n.formatWorkDuration(10L);
- verify(i18n).formatWorkDuration(any(Locale.class), eq(10L));
+ jRubyI18n.formatWorkDuration(Duration.create(10L));
+ verify(i18n).formatWorkDuration(any(Locale.class), eq(Duration.create(10L)));
+ }
+
+ @Test
+ public void format_long_work_duration() throws Exception {
+ jRubyI18n.formatLongWorkDuration(10L);
+ verify(i18n).formatWorkDuration(any(Locale.class), eq(Duration.create(10L)));
}
}