|
35 | 35 | import org.springframework.data.mapping.context.SampleMappingContext;
|
36 | 36 | import org.springframework.data.mapping.context.SamplePersistentProperty;
|
37 | 37 |
|
| 38 | +import lombok.Data; |
| 39 | + |
38 | 40 | /**
|
39 | 41 | * Unit tests for {@link ClassGeneratingPropertyAccessorFactory}
|
40 | 42 | *
|
@@ -67,21 +69,39 @@ public static List<Object[]> parameters() throws Exception {
|
67 | 69 | List<Class<?>> types = Arrays.asList(FieldAccess.class, PropertyAccess.class);
|
68 | 70 |
|
69 | 71 | parameters.addAll(parameters(types, "primitiveInteger", Integer.valueOf(1)));
|
| 72 | + parameters.addAll(parameters(types, "primitiveIntegerArray", new int[] { 1, 2, 3 })); |
70 | 73 | parameters.addAll(parameters(types, "boxedInteger", Integer.valueOf(1)));
|
| 74 | + parameters.addAll(parameters(types, "boxedIntegerArray", new Integer[] { Integer.valueOf(1) })); |
71 | 75 | parameters.addAll(parameters(types, "primitiveShort", Short.valueOf("1")));
|
| 76 | + parameters.addAll(parameters(types, "primitiveShortArray", new short[] { 1, 2, 3 })); |
72 | 77 | parameters.addAll(parameters(types, "boxedShort", Short.valueOf("1")));
|
| 78 | + parameters.addAll(parameters(types, "boxedShortArray", new Short[] { Short.valueOf("1") })); |
73 | 79 | parameters.addAll(parameters(types, "primitiveByte", Byte.valueOf("1")));
|
| 80 | + parameters.addAll(parameters(types, "primitiveByteArray", new byte[] { 1, 2, 3 })); |
74 | 81 | parameters.addAll(parameters(types, "boxedByte", Byte.valueOf("1")));
|
| 82 | + parameters.addAll(parameters(types, "boxedByteArray", new Byte[] { Byte.valueOf("1") })); |
75 | 83 | parameters.addAll(parameters(types, "primitiveChar", Character.valueOf('c')));
|
| 84 | + parameters.addAll(parameters(types, "primitiveCharArray", new char[] { 'a', 'b', 'c' })); |
76 | 85 | parameters.addAll(parameters(types, "boxedChar", Character.valueOf('c')));
|
| 86 | + parameters.addAll(parameters(types, "boxedCharArray", new Character[] { Character.valueOf('c') })); |
77 | 87 | parameters.addAll(parameters(types, "primitiveBoolean", Boolean.valueOf(true)));
|
| 88 | + parameters.addAll(parameters(types, "primitiveBooleanArray", new boolean[] { true, false })); |
78 | 89 | parameters.addAll(parameters(types, "boxedBoolean", Boolean.valueOf(true)));
|
| 90 | + parameters.addAll(parameters(types, "boxedBooleanArray", new Boolean[] { Boolean.valueOf(true) })); |
79 | 91 | parameters.addAll(parameters(types, "primitiveFloat", Float.valueOf(1f)));
|
| 92 | + parameters.addAll(parameters(types, "primitiveFloatArray", new float[] { 1f, 2f })); |
80 | 93 | parameters.addAll(parameters(types, "boxedFloat", Float.valueOf(1f)));
|
| 94 | + parameters.addAll(parameters(types, "boxedFloatArray", new Float[] { Float.valueOf(1f) })); |
81 | 95 | parameters.addAll(parameters(types, "primitiveDouble", Double.valueOf(1d)));
|
| 96 | + parameters.addAll(parameters(types, "primitiveDoubleArray", new double[] { 1d, 2d })); |
82 | 97 | parameters.addAll(parameters(types, "boxedDouble", Double.valueOf(1d)));
|
| 98 | + parameters.addAll(parameters(types, "boxedDoubleArray", new Double[] { Double.valueOf(1d) })); |
83 | 99 | parameters.addAll(parameters(types, "primitiveLong", Long.valueOf(1L)));
|
| 100 | + parameters.addAll(parameters(types, "primitiveLongArray", new long[] { 1L, 2L })); |
84 | 101 | parameters.addAll(parameters(types, "boxedLong", Long.valueOf(1L)));
|
| 102 | + parameters.addAll(parameters(types, "boxedLongArray", new Long[] { Long.valueOf(1L) })); |
| 103 | + parameters.addAll(parameters(types, "string", "hello")); |
| 104 | + parameters.addAll(parameters(types, "stringArray", new String[] { "hello", "world" })); |
85 | 105 |
|
86 | 106 | return parameters;
|
87 | 107 | }
|
@@ -130,188 +150,98 @@ private PersistentProperty<?> getProperty(Object bean, String name) {
|
130 | 150 | public static class FieldAccess {
|
131 | 151 |
|
132 | 152 | int primitiveInteger;
|
| 153 | + int primitiveIntegerArray[]; |
133 | 154 | Integer boxedInteger;
|
| 155 | + Integer boxedIntegerArray[]; |
134 | 156 |
|
135 | 157 | short primitiveShort;
|
| 158 | + short primitiveShortArray[]; |
136 | 159 | Short boxedShort;
|
| 160 | + Short boxedShortArray[]; |
137 | 161 |
|
138 | 162 | byte primitiveByte;
|
| 163 | + byte primitiveByteArray[]; |
139 | 164 | Byte boxedByte;
|
| 165 | + Byte boxedByteArray[]; |
140 | 166 |
|
141 | 167 | char primitiveChar;
|
| 168 | + char primitiveCharArray[]; |
142 | 169 | Character boxedChar;
|
| 170 | + Character boxedCharArray[]; |
143 | 171 |
|
144 | 172 | boolean primitiveBoolean;
|
| 173 | + boolean primitiveBooleanArray[]; |
145 | 174 | Boolean boxedBoolean;
|
| 175 | + Boolean boxedBooleanArray[]; |
146 | 176 |
|
147 | 177 | float primitiveFloat;
|
| 178 | + float primitiveFloatArray[]; |
148 | 179 | Float boxedFloat;
|
| 180 | + Float boxedFloatArray[]; |
149 | 181 |
|
150 | 182 | double primitiveDouble;
|
| 183 | + double primitiveDoubleArray[]; |
151 | 184 | Double boxedDouble;
|
| 185 | + Double boxedDoubleArray[]; |
152 | 186 |
|
153 | 187 | long primitiveLong;
|
| 188 | + long primitiveLongArray[]; |
154 | 189 | Long boxedLong;
|
| 190 | + Long boxedLongArray[]; |
155 | 191 |
|
| 192 | + String string; |
| 193 | + String stringArray[]; |
156 | 194 | }
|
157 | 195 |
|
158 | 196 | /**
|
159 | 197 | * @see DATACMNS-809
|
160 | 198 | */
|
161 | 199 | @AccessType(Type.PROPERTY)
|
| 200 | + @Data |
162 | 201 | public static class PropertyAccess {
|
163 | 202 |
|
164 | 203 | int primitiveInteger;
|
| 204 | + int primitiveIntegerArray[]; |
165 | 205 | Integer boxedInteger;
|
| 206 | + Integer boxedIntegerArray[]; |
166 | 207 |
|
167 | 208 | short primitiveShort;
|
| 209 | + short primitiveShortArray[]; |
168 | 210 | Short boxedShort;
|
| 211 | + Short boxedShortArray[]; |
169 | 212 |
|
170 | 213 | byte primitiveByte;
|
| 214 | + byte primitiveByteArray[]; |
171 | 215 | Byte boxedByte;
|
| 216 | + Byte boxedByteArray[]; |
172 | 217 |
|
173 | 218 | char primitiveChar;
|
| 219 | + char primitiveCharArray[]; |
174 | 220 | Character boxedChar;
|
| 221 | + Character boxedCharArray[]; |
175 | 222 |
|
176 | 223 | boolean primitiveBoolean;
|
| 224 | + boolean primitiveBooleanArray[]; |
177 | 225 | Boolean boxedBoolean;
|
| 226 | + Boolean boxedBooleanArray[]; |
178 | 227 |
|
179 | 228 | float primitiveFloat;
|
| 229 | + float primitiveFloatArray[]; |
180 | 230 | Float boxedFloat;
|
| 231 | + Float boxedFloatArray[]; |
181 | 232 |
|
182 | 233 | double primitiveDouble;
|
| 234 | + double primitiveDoubleArray[]; |
183 | 235 | Double boxedDouble;
|
| 236 | + Double boxedDoubleArray[]; |
184 | 237 |
|
185 | 238 | long primitiveLong;
|
| 239 | + long primitiveLongArray[]; |
186 | 240 | Long boxedLong;
|
| 241 | + Long boxedLongArray[]; |
187 | 242 |
|
188 |
| - public int getPrimitiveInteger() { |
189 |
| - return primitiveInteger; |
190 |
| - } |
191 |
| - |
192 |
| - public void setPrimitiveInteger(int primitiveInteger) { |
193 |
| - this.primitiveInteger = primitiveInteger; |
194 |
| - } |
195 |
| - |
196 |
| - public Integer getBoxedInteger() { |
197 |
| - return boxedInteger; |
198 |
| - } |
199 |
| - |
200 |
| - public void setBoxedInteger(Integer boxedInteger) { |
201 |
| - this.boxedInteger = boxedInteger; |
202 |
| - } |
203 |
| - |
204 |
| - public short getPrimitiveShort() { |
205 |
| - return primitiveShort; |
206 |
| - } |
207 |
| - |
208 |
| - public void setPrimitiveShort(short primitiveShort) { |
209 |
| - this.primitiveShort = primitiveShort; |
210 |
| - } |
211 |
| - |
212 |
| - public Short getBoxedShort() { |
213 |
| - return boxedShort; |
214 |
| - } |
215 |
| - |
216 |
| - public void setBoxedShort(Short boxedShort) { |
217 |
| - this.boxedShort = boxedShort; |
218 |
| - } |
219 |
| - |
220 |
| - public byte getPrimitiveByte() { |
221 |
| - return primitiveByte; |
222 |
| - } |
223 |
| - |
224 |
| - public void setPrimitiveByte(byte primitiveByte) { |
225 |
| - this.primitiveByte = primitiveByte; |
226 |
| - } |
227 |
| - |
228 |
| - public Byte getBoxedByte() { |
229 |
| - return boxedByte; |
230 |
| - } |
231 |
| - |
232 |
| - public void setBoxedByte(Byte boxedByte) { |
233 |
| - this.boxedByte = boxedByte; |
234 |
| - } |
235 |
| - |
236 |
| - public char getPrimitiveChar() { |
237 |
| - return primitiveChar; |
238 |
| - } |
239 |
| - |
240 |
| - public void setPrimitiveChar(char primitiveChar) { |
241 |
| - this.primitiveChar = primitiveChar; |
242 |
| - } |
243 |
| - |
244 |
| - public Character getBoxedChar() { |
245 |
| - return boxedChar; |
246 |
| - } |
247 |
| - |
248 |
| - public void setBoxedChar(Character boxedChar) { |
249 |
| - this.boxedChar = boxedChar; |
250 |
| - } |
251 |
| - |
252 |
| - public boolean isPrimitiveBoolean() { |
253 |
| - return primitiveBoolean; |
254 |
| - } |
255 |
| - |
256 |
| - public void setPrimitiveBoolean(boolean primitiveBoolean) { |
257 |
| - this.primitiveBoolean = primitiveBoolean; |
258 |
| - } |
259 |
| - |
260 |
| - public Boolean getBoxedBoolean() { |
261 |
| - return boxedBoolean; |
262 |
| - } |
263 |
| - |
264 |
| - public void setBoxedBoolean(Boolean boxedBoolean) { |
265 |
| - this.boxedBoolean = boxedBoolean; |
266 |
| - } |
267 |
| - |
268 |
| - public float getPrimitiveFloat() { |
269 |
| - return primitiveFloat; |
270 |
| - } |
271 |
| - |
272 |
| - public void setPrimitiveFloat(float primitiveFloat) { |
273 |
| - this.primitiveFloat = primitiveFloat; |
274 |
| - } |
275 |
| - |
276 |
| - public Float getBoxedFloat() { |
277 |
| - return boxedFloat; |
278 |
| - } |
279 |
| - |
280 |
| - public void setBoxedFloat(Float boxedFloat) { |
281 |
| - this.boxedFloat = boxedFloat; |
282 |
| - } |
283 |
| - |
284 |
| - public double getPrimitiveDouble() { |
285 |
| - return primitiveDouble; |
286 |
| - } |
287 |
| - |
288 |
| - public void setPrimitiveDouble(double primitiveDouble) { |
289 |
| - this.primitiveDouble = primitiveDouble; |
290 |
| - } |
291 |
| - |
292 |
| - public Double getBoxedDouble() { |
293 |
| - return boxedDouble; |
294 |
| - } |
295 |
| - |
296 |
| - public void setBoxedDouble(Double boxedDouble) { |
297 |
| - this.boxedDouble = boxedDouble; |
298 |
| - } |
299 |
| - |
300 |
| - public long getPrimitiveLong() { |
301 |
| - return primitiveLong; |
302 |
| - } |
303 |
| - |
304 |
| - public void setPrimitiveLong(long primitiveLong) { |
305 |
| - this.primitiveLong = primitiveLong; |
306 |
| - } |
307 |
| - |
308 |
| - public Long getBoxedLong() { |
309 |
| - return boxedLong; |
310 |
| - } |
311 |
| - |
312 |
| - public void setBoxedLong(Long boxedLong) { |
313 |
| - this.boxedLong = boxedLong; |
314 |
| - } |
| 243 | + String string; |
| 244 | + String stringArray[]; |
315 | 245 | }
|
316 | 246 |
|
317 | 247 | }
|
0 commit comments