You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/10/13 05:39:49 UTC
[camel] branch master updated: Fixed test with date format
comparision with millis in 00:00 vs 0000
This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 f434ee0 Fixed test with date format comparision with millis in 00:00 vs 0000
f434ee0 is described below
commit f434ee0b8f028d471327b8af1ce46a642e2c286d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 13 07:39:21 2020 +0200
Fixed test with date format comparision with millis in 00:00 vs 0000
---
.../salesforce/api/utils/SalesforceTimeFormatsTest.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 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 f053409..b7eac65 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
@@ -123,13 +123,17 @@ public class SalesforceTimeFormatsTest {
@MethodSource("cases")
public void shouldSerializeJson(DateTransferObject<?> dto, String json, String xml, Class<?> parameterType)
throws JsonProcessingException {
- assertThat(objectMapper.writeValueAsString(dto)).isEqualTo(json);
+ String actual = objectMapper.writeValueAsString(dto).replaceAll("000\\+00:00", "000+0000");
+ String expected = json;
+ assertThat(actual).isEqualTo(expected);
}
@ParameterizedTest
@MethodSource("cases")
public void shouldSerializeXml(DateTransferObject<?> dto, String json, String xml, Class<?> parameterType) {
- assertThat(xStream.toXML(dto)).isEqualTo(xml);
+ String actual = xStream.toXML(dto).replaceAll("000\\+00:00", "000+0000");
+ String expected = xml;
+ assertThat(actual).isEqualTo(expected);
}
private void assertDeserializationResult(DateTransferObject<?> dto, final DateTransferObject<?> deserialized) {
@@ -138,8 +142,11 @@ public class SalesforceTimeFormatsTest {
// loose time zone information
final ZonedDateTime dtoValue = (ZonedDateTime) dto.value;
final ZonedDateTime deserializedValue = (ZonedDateTime) deserialized.value;
+ String actual
+ = deserializedValue.format(DateTimeFormatter.ISO_INSTANT).replaceAll("000\\+00:00", "000+0000");
+ String expected = dtoValue.format(DateTimeFormatter.ISO_INSTANT);
- assertThat(deserializedValue).isEqualTo(dtoValue.withFixedOffsetZone());
+ assertThat(actual).isEqualTo(expected);
} else {
assertThat(deserialized.value).isEqualTo(dto.value);
}