Skip to content

Commit 44dcd78

Browse files
committed
More work on #97 merging
1 parent 2947313 commit 44dcd78

File tree

1 file changed

+106
-3
lines changed

1 file changed

+106
-3
lines changed

csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ModuleTestBase.java

Lines changed: 106 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import java.io.IOException;
44
import java.nio.charset.StandardCharsets;
55
import java.util.Arrays;
6+
import java.util.List;
7+
import java.util.Locale;
8+
import java.util.Map;
69

710
import com.fasterxml.jackson.core.*;
811
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -11,12 +14,55 @@ public abstract class ModuleTestBase extends junit.framework.TestCase
1114
{
1215
public enum Gender { MALE, FEMALE };
1316

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+
1460
/**
1561
* Slightly modified sample class from Jackson tutorial ("JacksonInFiveMinutes")
1662
*/
1763
@JsonPropertyOrder({"firstName", "lastName", "gender" ,"verified", "userImage"})
18-
protected static class FiveMinuteUser {
19-
64+
protected static class FiveMinuteUser
65+
{
2066
private Gender _gender;
2167

2268
public String firstName, lastName;
@@ -70,6 +116,43 @@ public int hashCode() {
70116
}
71117
}
72118

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+
73156
@JsonPropertyOrder({"id", "desc"})
74157
protected static class IdDesc {
75158
public String id, desc;
@@ -80,7 +163,27 @@ public IdDesc(String id, String desc) {
80163
this.desc = desc;
81164
}
82165
}
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+
84187
protected ModuleTestBase() { }
85188

86189
/*

0 commit comments

Comments
 (0)