1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .beans ;
18
18
19
- import java .net .MalformedURLException ;
20
19
import java .util .ArrayList ;
21
20
import java .util .Arrays ;
22
21
import java .util .Collection ;
@@ -86,7 +85,7 @@ public void testGenericSetWithConversionFailure() {
86
85
}
87
86
88
87
@ Test
89
- public void testGenericList () throws MalformedURLException {
88
+ public void testGenericList () throws Exception {
90
89
GenericBean <?> gb = new GenericBean <>();
91
90
BeanWrapper bw = new BeanWrapperImpl (gb );
92
91
List <String > input = new ArrayList <>();
@@ -98,7 +97,7 @@ public void testGenericList() throws MalformedURLException {
98
97
}
99
98
100
99
@ Test
101
- public void testGenericListElement () throws MalformedURLException {
100
+ public void testGenericListElement () throws Exception {
102
101
GenericBean <?> gb = new GenericBean <>();
103
102
gb .setResourceList (new ArrayList <>());
104
103
BeanWrapper bw = new BeanWrapperImpl (gb );
@@ -195,7 +194,7 @@ public void testGenericMapFromProperties() {
195
194
}
196
195
197
196
@ Test
198
- public void testGenericListOfLists () throws MalformedURLException {
197
+ public void testGenericListOfLists () {
199
198
GenericBean <String > gb = new GenericBean <>();
200
199
List <List <Integer >> list = new LinkedList <>();
201
200
list .add (new LinkedList <>());
@@ -207,7 +206,7 @@ public void testGenericListOfLists() throws MalformedURLException {
207
206
}
208
207
209
208
@ Test
210
- public void testGenericListOfListsWithElementConversion () throws MalformedURLException {
209
+ public void testGenericListOfListsWithElementConversion () {
211
210
GenericBean <String > gb = new GenericBean <>();
212
211
List <List <Integer >> list = new LinkedList <>();
213
212
list .add (new LinkedList <>());
@@ -219,7 +218,7 @@ public void testGenericListOfListsWithElementConversion() throws MalformedURLExc
219
218
}
220
219
221
220
@ Test
222
- public void testGenericListOfArrays () throws MalformedURLException {
221
+ public void testGenericListOfArrays () {
223
222
GenericBean <String > gb = new GenericBean <>();
224
223
ArrayList <String []> list = new ArrayList <>();
225
224
list .add (new String [] {"str1" , "str2" });
@@ -231,7 +230,7 @@ public void testGenericListOfArrays() throws MalformedURLException {
231
230
}
232
231
233
232
@ Test
234
- public void testGenericListOfArraysWithElementConversion () throws MalformedURLException {
233
+ public void testGenericListOfArraysWithElementConversion () {
235
234
GenericBean <String > gb = new GenericBean <>();
236
235
ArrayList <String []> list = new ArrayList <>();
237
236
list .add (new String [] {"str1" , "str2" });
@@ -244,7 +243,7 @@ public void testGenericListOfArraysWithElementConversion() throws MalformedURLEx
244
243
}
245
244
246
245
@ Test
247
- public void testGenericListOfMaps () throws MalformedURLException {
246
+ public void testGenericListOfMaps () {
248
247
GenericBean <String > gb = new GenericBean <>();
249
248
List <Map <Integer , Long >> list = new LinkedList <>();
250
249
list .add (new HashMap <>());
@@ -256,7 +255,7 @@ public void testGenericListOfMaps() throws MalformedURLException {
256
255
}
257
256
258
257
@ Test
259
- public void testGenericListOfMapsWithElementConversion () throws MalformedURLException {
258
+ public void testGenericListOfMapsWithElementConversion () {
260
259
GenericBean <String > gb = new GenericBean <>();
261
260
List <Map <Integer , Long >> list = new LinkedList <>();
262
261
list .add (new HashMap <>());
@@ -268,7 +267,7 @@ public void testGenericListOfMapsWithElementConversion() throws MalformedURLExce
268
267
}
269
268
270
269
@ Test
271
- public void testGenericMapOfMaps () throws MalformedURLException {
270
+ public void testGenericMapOfMaps () {
272
271
GenericBean <String > gb = new GenericBean <>();
273
272
Map <String , Map <Integer , Long >> map = new HashMap <>();
274
273
map .put ("mykey" , new HashMap <>());
@@ -280,7 +279,7 @@ public void testGenericMapOfMaps() throws MalformedURLException {
280
279
}
281
280
282
281
@ Test
283
- public void testGenericMapOfMapsWithElementConversion () throws MalformedURLException {
282
+ public void testGenericMapOfMapsWithElementConversion () {
284
283
GenericBean <String > gb = new GenericBean <>();
285
284
Map <String , Map <Integer , Long >> map = new HashMap <>();
286
285
map .put ("mykey" , new HashMap <>());
@@ -292,7 +291,7 @@ public void testGenericMapOfMapsWithElementConversion() throws MalformedURLExcep
292
291
}
293
292
294
293
@ Test
295
- public void testGenericMapOfLists () throws MalformedURLException {
294
+ public void testGenericMapOfLists () {
296
295
GenericBean <String > gb = new GenericBean <>();
297
296
Map <Integer , List <Integer >> map = new HashMap <>();
298
297
map .put (1 , new LinkedList <>());
@@ -304,7 +303,7 @@ public void testGenericMapOfLists() throws MalformedURLException {
304
303
}
305
304
306
305
@ Test
307
- public void testGenericMapOfListsWithElementConversion () throws MalformedURLException {
306
+ public void testGenericMapOfListsWithElementConversion () {
308
307
GenericBean <String > gb = new GenericBean <>();
309
308
Map <Integer , List <Integer >> map = new HashMap <>();
310
309
map .put (1 , new LinkedList <>());
@@ -316,7 +315,7 @@ public void testGenericMapOfListsWithElementConversion() throws MalformedURLExce
316
315
}
317
316
318
317
@ Test
319
- public void testGenericTypeNestingMapOfInteger () throws Exception {
318
+ public void testGenericTypeNestingMapOfInteger () {
320
319
Map <String , String > map = new HashMap <>();
321
320
map .put ("testKey" , "100" );
322
321
@@ -330,7 +329,7 @@ public void testGenericTypeNestingMapOfInteger() throws Exception {
330
329
}
331
330
332
331
@ Test
333
- public void testGenericTypeNestingMapOfListOfInteger () throws Exception {
332
+ public void testGenericTypeNestingMapOfListOfInteger () {
334
333
Map <String , List <String >> map = new HashMap <>();
335
334
List <String > list = Arrays .asList (new String [] {"1" , "2" , "3" });
336
335
map .put ("testKey" , list );
@@ -340,13 +339,12 @@ public void testGenericTypeNestingMapOfListOfInteger() throws Exception {
340
339
bw .setPropertyValue ("mapOfListOfInteger" , map );
341
340
342
341
Object obj = gb .getMapOfListOfInteger ().get ("testKey" ).get (0 );
343
- boolean condition = obj instanceof Integer ;
344
- assertThat (condition ).isTrue ();
342
+ assertThat (obj instanceof Integer ).isTrue ();
345
343
assertThat (((Integer ) obj ).intValue ()).isEqualTo (1 );
346
344
}
347
345
348
346
@ Test
349
- public void testGenericTypeNestingListOfMapOfInteger () throws Exception {
347
+ public void testGenericTypeNestingListOfMapOfInteger () {
350
348
List <Map <String , String >> list = new LinkedList <>();
351
349
Map <String , String > map = new HashMap <>();
352
350
map .put ("testKey" , "5" );
@@ -357,13 +355,12 @@ public void testGenericTypeNestingListOfMapOfInteger() throws Exception {
357
355
bw .setPropertyValue ("listOfMapOfInteger" , list );
358
356
359
357
Object obj = gb .getListOfMapOfInteger ().get (0 ).get ("testKey" );
360
- boolean condition = obj instanceof Integer ;
361
- assertThat (condition ).isTrue ();
358
+ assertThat (obj instanceof Integer ).isTrue ();
362
359
assertThat (((Integer ) obj ).intValue ()).isEqualTo (5 );
363
360
}
364
361
365
362
@ Test
366
- public void testGenericTypeNestingMapOfListOfListOfInteger () throws Exception {
363
+ public void testGenericTypeNestingMapOfListOfListOfInteger () {
367
364
Map <String , List <List <String >>> map = new HashMap <>();
368
365
List <String > list = Arrays .asList (new String [] {"1" , "2" , "3" });
369
366
map .put ("testKey" , Collections .singletonList (list ));
@@ -373,8 +370,7 @@ public void testGenericTypeNestingMapOfListOfListOfInteger() throws Exception {
373
370
bw .setPropertyValue ("mapOfListOfListOfInteger" , map );
374
371
375
372
Object obj = gb .getMapOfListOfListOfInteger ().get ("testKey" ).get (0 ).get (0 );
376
- boolean condition = obj instanceof Integer ;
377
- assertThat (condition ).isTrue ();
373
+ assertThat (obj instanceof Integer ).isTrue ();
378
374
assertThat (((Integer ) obj ).intValue ()).isEqualTo (1 );
379
375
}
380
376
@@ -465,7 +461,7 @@ public void testComplexDerivedIndexedMapEntryWithCollectionConversion() {
465
461
}
466
462
467
463
@ Test
468
- public void testGenericallyTypedIntegerBean () throws Exception {
464
+ public void testGenericallyTypedIntegerBean () {
469
465
GenericIntegerBean gb = new GenericIntegerBean ();
470
466
BeanWrapper bw = new BeanWrapperImpl (gb );
471
467
bw .setPropertyValue ("genericProperty" , "10" );
@@ -476,7 +472,7 @@ public void testGenericallyTypedIntegerBean() throws Exception {
476
472
}
477
473
478
474
@ Test
479
- public void testGenericallyTypedSetOfIntegerBean () throws Exception {
475
+ public void testGenericallyTypedSetOfIntegerBean () {
480
476
GenericSetOfIntegerBean gb = new GenericSetOfIntegerBean ();
481
477
BeanWrapper bw = new BeanWrapperImpl (gb );
482
478
bw .setPropertyValue ("genericProperty" , "10" );
0 commit comments