3
3
import java .io .IOException ;
4
4
import java .nio .charset .StandardCharsets ;
5
5
import java .util .Arrays ;
6
+ import java .util .List ;
7
+ import java .util .Locale ;
8
+ import java .util .Map ;
6
9
7
10
import com .fasterxml .jackson .core .*;
8
11
import com .fasterxml .jackson .annotation .JsonPropertyOrder ;
@@ -11,12 +14,55 @@ public abstract class ModuleTestBase extends junit.framework.TestCase
11
14
{
12
15
public enum Gender { MALE , FEMALE };
13
16
17
+ protected static class Address {
18
+ private String streetName ;
19
+
20
+ private String city ;
21
+
22
+ public Address (String streetName , String city ) {
23
+ this .streetName = streetName ;
24
+ this .city = city ;
25
+ }
26
+
27
+ public String getStreetName () {
28
+ return streetName ;
29
+ }
30
+
31
+ public void setStreetName (String streetName ) {
32
+ this .streetName = streetName ;
33
+ }
34
+
35
+ public String getCity () {
36
+ return city ;
37
+ }
38
+
39
+ public void setCity (String city ) {
40
+ this .city = city ;
41
+ }
42
+ }
43
+
44
+ protected static class LocalizedValue {
45
+ private String value ;
46
+
47
+ public LocalizedValue (String value ) {
48
+ this .value = value ;
49
+ }
50
+
51
+ public String getValue () {
52
+ return value ;
53
+ }
54
+
55
+ public void setValue (String value ) {
56
+ this .value = value ;
57
+ }
58
+ }
59
+
14
60
/**
15
61
* Slightly modified sample class from Jackson tutorial ("JacksonInFiveMinutes")
16
62
*/
17
63
@ JsonPropertyOrder ({"firstName" , "lastName" , "gender" ,"verified" , "userImage" })
18
- protected static class FiveMinuteUser {
19
-
64
+ protected static class FiveMinuteUser
65
+ {
20
66
private Gender _gender ;
21
67
22
68
public String firstName , lastName ;
@@ -70,6 +116,43 @@ public int hashCode() {
70
116
}
71
117
}
72
118
119
+ public static class TenMinuteUser extends FiveMinuteUser {
120
+
121
+ private Address _address ;
122
+
123
+ public TenMinuteUser (String first , String last , boolean verified , Gender g , byte [] data , Address address )
124
+ {
125
+ super (first , last , verified , g , data );
126
+ _address = address ;
127
+ }
128
+
129
+ public Address getAddress () {
130
+ return _address ;
131
+ }
132
+
133
+ public void setAddress (Address address ) {
134
+ this ._address = address ;
135
+ }
136
+ }
137
+
138
+ public static class FifteenMinuteUser extends FiveMinuteUser {
139
+
140
+ private Map <Locale , LocalizedValue > localizedName ;
141
+
142
+ public FifteenMinuteUser (String first , String last , boolean verified , Gender g , byte [] data , Map <Locale , LocalizedValue > localizedName ) {
143
+ super (first , last , verified , g , data );
144
+ this .localizedName = localizedName ;
145
+ }
146
+
147
+ public Map <Locale , LocalizedValue > getLocalizedName () {
148
+ return localizedName ;
149
+ }
150
+
151
+ public void setLocalizedName (Map <Locale , LocalizedValue > localizedName ) {
152
+ this .localizedName = localizedName ;
153
+ }
154
+ }
155
+
73
156
@ JsonPropertyOrder ({"id" , "desc" })
74
157
protected static class IdDesc {
75
158
public String id , desc ;
@@ -80,7 +163,27 @@ public IdDesc(String id, String desc) {
80
163
this .desc = desc ;
81
164
}
82
165
}
83
-
166
+
167
+ @ JsonPropertyOrder ({ "x" , "y" })
168
+ protected static class Point {
169
+ public int x , y ;
170
+
171
+ protected Point () { }
172
+ public Point (int x0 , int y0 ) {
173
+ x = x0 ;
174
+ y = y0 ;
175
+ }
176
+ }
177
+
178
+ protected static class Points {
179
+ public List <Point > p ;
180
+
181
+ protected Points () { }
182
+ public Points (Point ... p0 ) {
183
+ p = Arrays .asList (p0 );
184
+ }
185
+ }
186
+
84
187
protected ModuleTestBase () { }
85
188
86
189
/*
0 commit comments