1
- package com .fasterxml .jackson .databind .tofix ;
1
+ package com .fasterxml .jackson .databind .struct ;
2
2
3
3
import java .util .Map ;
4
4
import java .util .TreeMap ;
8
8
import com .fasterxml .jackson .annotation .*;
9
9
import com .fasterxml .jackson .databind .ObjectMapper ;
10
10
import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
11
- import com .fasterxml .jackson .databind .testutil .failure .JacksonTestFailureExpected ;
12
11
13
12
import static org .junit .jupiter .api .Assertions .assertEquals ;
14
13
@@ -21,7 +20,6 @@ static class WrapperForAnyGetter {
21
20
public BeanWithAnyGetter value ;
22
21
}
23
22
24
- @ JsonPropertyOrder ({ "firstProperty" , "secondProperties" , "anyProperty" , "forthProperty" })
25
23
@ JsonFormat (shape = JsonFormat .Shape .ARRAY )
26
24
static class BeanWithAnyGetter {
27
25
public String firstProperty = "first" ;
@@ -38,47 +36,22 @@ public Map<String, String> getAnyProperty() {
38
36
39
37
final ObjectMapper MAPPER = newJsonMapper ();
40
38
41
- @ JacksonTestFailureExpected
42
39
@ Test
43
40
public void testSerializeArrayWithAnyGetterWithWrapper () throws Exception {
44
41
WrapperForAnyGetter wrapper = new WrapperForAnyGetter ();
45
42
wrapper .value = new BeanWithAnyGetter ();
46
43
47
44
String json = MAPPER .writeValueAsString (wrapper );
48
45
49
- // In 2.19, Fails Actual
50
- // : {"value":{"firstProperty":"first","secondProperties":"second","forthProperty":"forth","third_A":"third_A","third_B":"third_B"}}
51
- // Getting better, after #4775 in 2.19, fails Actual
52
- // : {"value":["first","second",{"third_A":"third_A","third_B":"third_B"},"forth"]}
53
- assertEquals (a2q ("{'value':" +
54
- "[" +
55
- "'first'," +
56
- "'second'," +
57
- "'forth'," +
58
- "'third_A'," +
59
- "'third_B'" +
60
- "]" +
61
- "}" ), json );
46
+ assertEquals (a2q ("{\" value\" :[\" first\" ,\" second\" ,\" forth\" ,{\" third_A\" :\" third_A\" ,\" third_B\" :\" third_B\" }]}" ), json );
62
47
}
63
48
64
- @ JacksonTestFailureExpected
65
49
@ Test
66
50
public void testSerializeArrayWithAnyGetterAsRoot () throws Exception {
67
51
BeanWithAnyGetter bean = new BeanWithAnyGetter ();
68
52
69
53
String json = MAPPER .writeValueAsString (bean );
70
54
71
- // In 2.19, Fails Actual
72
- // : {"firstProperty":"first","secondProperties":"second","forthProperty":"forth","third_A":"third_A","third_B":"third_B"}
73
-
74
- // Getting better, after #4775 in 2.19, fails Actual
75
- // : ["first","second",{"third_A":"third_A","third_B":"third_B"},"forth"]
76
- assertEquals (a2q ("[" +
77
- "'first'," +
78
- "'second'," +
79
- "'forth'," +
80
- "'third_A'," +
81
- "'third_B'" +
82
- "]" ), json );
55
+ assertEquals (a2q ("[\" first\" ,\" second\" ,\" forth\" ,{\" third_A\" :\" third_A\" ,\" third_B\" :\" third_B\" }]" ), json );
83
56
}
84
57
}
0 commit comments