Skip to content

Commit

Permalink
Fix problem with backporting fix for #128
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 8, 2019
1 parent 880a69a commit 5a0ad70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class ZonedDateTimeAsKeyTest extends ModuleTestBase
};
private static final ZonedDateTime DATE_TIME_0 = ZonedDateTime.ofInstant(Instant.ofEpochSecond(0), ZoneOffset.UTC);
private static final String DATE_TIME_0_STRING = "1970-01-01T00:00:00Z";
private static final Instant DATE_TIME_0_INSTANT = DATE_TIME_0.toInstant();

private static final ZonedDateTime DATE_TIME_1 = ZonedDateTime.of(
2015, 3, 14, 9, 26, 53, 590 * 1000 * 1000, ZoneOffset.UTC);
Expand Down Expand Up @@ -77,15 +76,15 @@ public void testDeserialization2() throws Exception {

@Test
public void testSerializationToInstantWithNanos() throws Exception {
String value = newMapperBuilder().enable(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS).build()
String value = mapperBuilder().enable(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS).build()
.writerFor(TYPE_REF).writeValueAsString(asMap(DATE_TIME_1, "test"));
Assert.assertEquals("Value is incorrect",
mapAsString(String.valueOf(DATE_TIME_1.toEpochSecond()) + '.' + DATE_TIME_1.getNano(), "test"), value);
}

@Test
public void testSerializationToInstantWithoutNanos() throws Exception {
String value = newMapperBuilder().enable(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS)
String value = mapperBuilder().enable(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS)
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS).build()
.writerFor(TYPE_REF).writeValueAsString(asMap(DATE_TIME_1, "test"));
Assert.assertEquals("Value is incorrect",
Expand Down
4 changes: 4 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ Michael O'Keeffe (kupci@github)
Michał Żmuda (zmumi@github)
* Reported #127: ZonedDateTime in map keys ignores option to write Zone IDs
(2.10.1)
* Reported #128: Timestamp keys from `ZonedDateTime`
(2.11.0)

Vetle Leinonen-Roeim (vetler@github)
* Contributed fix for #127: ZonedDateTime in map keys ignores option to write Zone IDs
(2.10.1)
* Contributed fix for #128: Timestamp keys from `ZonedDateTime`
(2.11.0)
3 changes: 2 additions & 1 deletion release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Modules:

2.11.0 (not yet released)

-
#128: Timestamp keys from `ZonedDateTime`
(reported by Michał Ż, fixed by Vetle L-R)

2.10.1 (not yet released)

Expand Down

0 comments on commit 5a0ad70

Please sign in to comment.