File tree 1 file changed +29
-0
lines changed
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/failing
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .datatype .jsr310 .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonFormat ;
4
+ import com .fasterxml .jackson .annotation .OptBoolean ;
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
6
+ import com .fasterxml .jackson .databind .exc .InvalidFormatException ;
7
+ import com .fasterxml .jackson .datatype .jsr310 .ModuleTestBase ;
8
+ import org .junit .Test ;
9
+
10
+ import java .time .LocalDate ;
11
+
12
+ public class LocalDateDeserTest extends ModuleTestBase {
13
+ private final ObjectMapper MAPPER = newMapper ();
14
+
15
+ final static class StrictWrapper {
16
+ @ JsonFormat (pattern ="yyyy-MM-dd" ,
17
+ lenient = OptBoolean .FALSE )
18
+ public LocalDate value ;
19
+
20
+ public StrictWrapper () { }
21
+ public StrictWrapper (LocalDate v ) { value = v ; }
22
+ }
23
+
24
+ @ Test (expected = InvalidFormatException .class )
25
+ public void testStrictCustomFormat () throws Exception
26
+ {
27
+ StrictWrapper w = MAPPER .readValue ("{\" value\" :\" 2019-11-31\" }" , StrictWrapper .class );
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments