File tree 1 file changed +57
-0
lines changed
src/test/java/com/fasterxml/jackson/failing
1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonCreator ;
4
+ import com .fasterxml .jackson .annotation .JsonProperty ;
5
+ import com .fasterxml .jackson .databind .DeserializationFeature ;
6
+ import com .fasterxml .jackson .databind .ObjectMapper ;
7
+ import org .junit .Test ;
8
+
9
+ import java .io .IOException ;
10
+ import java .util .Collections ;
11
+ import java .util .List ;
12
+
13
+ public class SingleValueAsArray1421Test
14
+ {
15
+ private static final String JSON = "[{\" message\" :\" messageHere\" }]" ;
16
+
17
+ static class A
18
+ {
19
+ List <B > bs = Collections .emptyList ();
20
+
21
+ @ JsonCreator
22
+ A (final List <B > bs )
23
+ {
24
+ this .bs = bs ;
25
+ }
26
+ }
27
+
28
+ static class B
29
+ {
30
+ List <C > cs = Collections .emptyList ();
31
+
32
+ @ JsonCreator
33
+ B (final List <C > cs )
34
+ {
35
+ this .cs = cs ;
36
+ }
37
+ }
38
+
39
+ public static class C
40
+ {
41
+ String message ;
42
+
43
+ @ JsonCreator
44
+ C (@ JsonProperty ("message" ) String message )
45
+ {
46
+ this .message = message ;
47
+ }
48
+ }
49
+
50
+ @ Test
51
+ public void testSuccessfulDeserializationOfObjectWithChainedArrayCreators () throws IOException
52
+ {
53
+ ObjectMapper om = new ObjectMapper ();
54
+ om .configure (DeserializationFeature .ACCEPT_SINGLE_VALUE_AS_ARRAY , true );
55
+ om .readValue (JSON , A .class );
56
+ }
57
+ }
You can’t perform that action at this time.
0 commit comments