File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/tofix Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .datatype .jsr310 .tofix ;
2
+
3
+ import java .time .Instant ;
4
+
5
+ import org .junit .jupiter .api .Test ;
6
+
7
+ import com .fasterxml .jackson .databind .ObjectReader ;
8
+ import com .fasterxml .jackson .datatype .jsr310 .ModuleTestBase ;
9
+ import com .fasterxml .jackson .datatype .jsr310 .testutil .failure .JacksonTestFailureExpected ;
10
+
11
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
12
+
13
+ // [modules-java8#359] InstantDeserializer deserializes the nanosecond portion of
14
+ // fractional timestamps incorrectly: -1.000000001 deserializes to 1969-12-31T23:59:59.000000001Z
15
+ // instead of 1969-12-31T23:59:58.999999999Z
16
+ public class InstantDeserializerNegative359Test
17
+ extends ModuleTestBase
18
+ {
19
+ private final ObjectReader READER = newMapper ().readerFor (Instant .class );
20
+
21
+ @ JacksonTestFailureExpected
22
+ @ Test
23
+ public void testDeserializationAsFloat04 ()
24
+ throws Exception
25
+ {
26
+ Instant actual = READER .readValue ("-1.000000001" );
27
+ Instant expected = Instant .ofEpochSecond (-1L , -1L );
28
+ assertEquals (expected , actual );
29
+ }
30
+
31
+ @ Test
32
+ public void testDeserializationAsFloat05 ()
33
+ throws Exception
34
+ {
35
+ Instant actual = READER .readValue ("-0.000000001" );
36
+ Instant expected = Instant .ofEpochSecond (0L , -1L );
37
+ assertEquals (expected , actual );
38
+ }
39
+ }
You can’t perform that action at this time.
0 commit comments