Skip to content

Commit 7410000

Browse files
committed
Add test cases for alternate zero zone offsets
1 parent 80be6cf commit 7410000

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/deser/InstantDeserTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,30 @@ public void testDeserializationFromStringWithZeroZoneOffset03() throws Exception
434434
assertEquals("The value is not correct.", date, result);
435435
}
436436

437+
@Test
438+
public void testDeserializationFromStringWithZeroZoneOffset04() throws Exception {
439+
Instant date = Instant.now();
440+
String json = formatWithZeroZoneOffset(date, "+00:30");
441+
Instant result = READER.readValue(json);
442+
assertNotEquals("The value is not correct.", date, result);
443+
}
444+
445+
@Test
446+
public void testDeserializationFromStringWithZeroZoneOffset05() throws Exception {
447+
Instant date = Instant.now();
448+
String json = formatWithZeroZoneOffset(date, "+01:30");
449+
Instant result = READER.readValue(json);
450+
assertNotEquals("The value is not correct.", date, result);
451+
}
452+
453+
@Test
454+
public void testDeserializationFromStringWithZeroZoneOffset06() throws Exception {
455+
Instant date = Instant.now();
456+
String json = formatWithZeroZoneOffset(date, "-00:00");
457+
Instant result = READER.readValue(json);
458+
assertEquals("The value is not correct.", date, result);
459+
}
460+
437461
private String formatWithZeroZoneOffset(Instant date, String offset){
438462
return '"' + FORMATTER.format(date).replaceFirst("Z$", offset) + '"';
439463
}

0 commit comments

Comments
 (0)