You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2018/03/25 11:51:26 UTC

[camel] branch master updated: CAMEL-12334: fix flaky test

This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new a0744f2  CAMEL-12334: fix flaky test
a0744f2 is described below

commit a0744f2f4c5407921619ca990218ff9bcb8c0c4b
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Sun Mar 25 13:51:22 2018 +0200

    CAMEL-12334: fix flaky test
    
    Test was using timezone from local date and comparing it to a period
    date in another offset due to DST.
---
 .../component/salesforce/api/utils/SalesforceTimeFormatsTest.java | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/SalesforceTimeFormatsTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/SalesforceTimeFormatsTest.java
index e4cd63b..53714f6 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/SalesforceTimeFormatsTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/SalesforceTimeFormatsTest.java
@@ -25,7 +25,6 @@ import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeFormatterBuilder;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.Objects;
@@ -100,10 +99,6 @@ public class SalesforceTimeFormatsTest {
 
     private static final String XML_FMT = "<Dto><value>%s</value></Dto>";
 
-    private static final DateTimeFormatter ZONE_OFFSET_FORMATTER = new DateTimeFormatterBuilder()//
-        .appendOffset("+HHMM", "Z")//
-        .toFormatter();
-
     @Parameter(0)
     public DateTransferObject<?> dto;
 
@@ -168,7 +163,8 @@ public class SalesforceTimeFormatsTest {
         final ZonedDateTime zonedDateTime = ZonedDateTime.of(localDate.atTime(10, 54, 57), ZoneId.of("Z"));
         final Instant instant = zonedDateTime.toInstant();
 
-        final String zone = ZONE_OFFSET_FORMATTER.format(ZonedDateTime.now());
+        final String zone = DateTimeFormatter.ofPattern("xx")
+            .format(zonedDateTime.withZoneSameLocal(ZoneId.systemDefault()));
 
         return Arrays.asList(//
             dto(Date.from(instant), "2007-03-19T10:54:57.000+0000"), // 0

-- 
To stop receiving notification emails like this one, please contact
zregvart@apache.org.