From 9d15b7fa9e254ff4f94228d68b5f4b11e45fd65c Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 19 Aug 2013 10:33:48 +0200 Subject: [PATCH] Use DateUtils.parseDateTime instead of DateUtils.parseDate in test to fix timezone issues --- .../org/sonar/batch/scan/DeprecatedJsonReportTest.java | 4 ++-- .../test/java/org/sonar/batch/scan/JsonReportTest.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedJsonReportTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedJsonReportTest.java index 2bd6062a195..00af2f5e558 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedJsonReportTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedJsonReportTest.java @@ -85,7 +85,7 @@ public class DeprecatedJsonReportTest { issue.setRuleKey(RuleKey.of("squid", "AvoidCycles")); issue.setSeverity(Severity.INFO); issue.setResolution(Issue.RESOLUTION_FALSE_POSITIVE); - issue.setCreationDate(DateUtils.parseDate("2013-01-30")); + issue.setCreationDate(DateUtils.parseDateTime("2013-01-30T00:00:00+0000")); issue.setNew(true); when(ruleI18nManager.getName("squid", "AvoidCycles", Locale.getDefault())).thenReturn("Avoid Cycles"); doReturn(Arrays.asList(issue)).when(deprecatedJsonReport).getIssues(resource); @@ -110,7 +110,7 @@ public class DeprecatedJsonReportTest { issue.setSeverity(Severity.INFO); issue.setResolution(null); issue.setNew(false); - issue.setCreationDate(DateUtils.parseDate("2013-01-30")); + issue.setCreationDate(DateUtils.parseDateTime("2013-01-30T00:00:00+0000")); when(ruleI18nManager.getName("squid", "AvoidCycles", Locale.getDefault())).thenReturn("Avoid Cycles"); doReturn(Arrays.asList(issue)).when(deprecatedJsonReport).getIssues(resource); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/JsonReportTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/JsonReportTest.java index 71cf7d91048..ce265bcfce2 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/JsonReportTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/JsonReportTest.java @@ -97,8 +97,8 @@ public class JsonReportTest { .setEffortToFix(3.14) .setReporter("julien") .setAssignee("simon") - .setCreationDate(DateUtils.parseDate("2013-04-24")) - .setUpdateDate(DateUtils.parseDate("2013-04-25")) + .setCreationDate(DateUtils.parseDateTime("2013-04-24T00:00:00+0000")) + .setUpdateDate(DateUtils.parseDateTime("2013-04-25T00:00:00+0000")) .setNew(false); when(ruleI18nManager.getName("squid", "AvoidCycles", Locale.getDefault())).thenReturn("Avoid Cycles"); when(jsonReport.getIssues()).thenReturn(Lists. newArrayList(issue)); @@ -118,9 +118,9 @@ public class JsonReportTest { .setRuleKey(RuleKey.of("squid", "AvoidCycles")) .setStatus(Issue.STATUS_CLOSED) .setResolution(Issue.RESOLUTION_FIXED) - .setCreationDate(DateUtils.parseDate("2013-04-24")) - .setUpdateDate(DateUtils.parseDate("2013-04-25")) - .setCloseDate(DateUtils.parseDate("2013-04-26")) + .setCreationDate(DateUtils.parseDateTime("2013-04-24T00:00:00+0000")) + .setUpdateDate(DateUtils.parseDateTime("2013-04-25T00:00:00+0000")) + .setCloseDate(DateUtils.parseDateTime("2013-04-26T00:00:00+0000")) .setNew(false); when(ruleI18nManager.getName("squid", "AvoidCycles", Locale.getDefault())).thenReturn("Avoid Cycles"); when(jsonReport.getIssues()).thenReturn(Lists. newArrayList(issue)); -- 2.39.5