@@ -510,6 +510,7 @@ public void convertCollectionToStringWithElementConversion() throws Exception {
510
510
}
511
511
512
512
@ Test
513
+ @ SuppressWarnings ("rawtypes" )
513
514
public void convertStringToCollection () {
514
515
List result = conversionService .convert ("1,2,3" , List .class );
515
516
assertEquals (3 , result .size ());
@@ -519,6 +520,7 @@ public void convertStringToCollection() {
519
520
}
520
521
521
522
@ Test
523
+ @ SuppressWarnings ("rawtypes" )
522
524
public void convertStringToCollectionWithElementConversion () throws Exception {
523
525
List result = (List ) conversionService .convert ("1,2,3" , TypeDescriptor .valueOf (String .class ),
524
526
new TypeDescriptor (getClass ().getField ("genericList" )));
@@ -529,6 +531,7 @@ public void convertStringToCollectionWithElementConversion() throws Exception {
529
531
}
530
532
531
533
@ Test
534
+ @ SuppressWarnings ("rawtypes" )
532
535
public void convertEmptyStringToCollection () {
533
536
Collection result = conversionService .convert ("" , Collection .class );
534
537
assertEquals (0 , result .size ());
@@ -557,6 +560,7 @@ public void convertCollectionToObjectAssignableTarget() throws Exception {
557
560
}
558
561
559
562
@ Test
563
+ @ SuppressWarnings ("rawtypes" )
560
564
public void convertCollectionToObjectWithCustomConverter () throws Exception {
561
565
List <String > source = new ArrayList <String >();
562
566
source .add ("A" );
@@ -572,8 +576,8 @@ public ListWrapper convert(List source) {
572
576
}
573
577
574
578
@ Test
579
+ @ SuppressWarnings ({ "cast" , "unchecked" })
575
580
public void convertObjectToCollection () {
576
- @ SuppressWarnings ("unchecked" )
577
581
List <String > result = (List <String >) conversionService .convert (3L , List .class );
578
582
assertEquals (1 , result .size ());
579
583
assertEquals (3L , result .get (0 ));
@@ -652,6 +656,7 @@ public void convertCollectionToCollectionNull() throws Exception {
652
656
}
653
657
654
658
@ Test
659
+ @ SuppressWarnings ("rawtypes" )
655
660
public void convertCollectionToCollectionNotGeneric () throws Exception {
656
661
Set <String > foo = new LinkedHashSet <String >();
657
662
foo .add ("1" );
@@ -664,8 +669,8 @@ public void convertCollectionToCollectionNotGeneric() throws Exception {
664
669
assertEquals ("3" , bar .get (2 ));
665
670
}
666
671
667
- @ SuppressWarnings ("unchecked" )
668
672
@ Test
673
+ @ SuppressWarnings ({ "unchecked" , "rawtypes" })
669
674
public void convertCollectionToCollectionSpecialCaseSourceImpl () throws Exception {
670
675
Map map = new LinkedHashMap ();
671
676
map .put ("1" , "1" );
@@ -783,9 +788,6 @@ public void convertObjectToStringUsingToString() {
783
788
SSN .reset ();
784
789
assertEquals ("123456789" , conversionService .convert (new SSN ("123456789" ), String .class ));
785
790
786
- // TODO What if the target type has a static factory method that takes precedence
787
- // over the source type's toString() method?
788
-
789
791
assertEquals ("constructor invocations" , 1 , SSN .constructorCount );
790
792
assertEquals ("toString() invocations" , 1 , SSN .toStringCount );
791
793
}
@@ -863,6 +865,7 @@ public char[] convert(String source) {
863
865
}
864
866
865
867
@ Test
868
+ @ SuppressWarnings ("unchecked" )
866
869
public void multidimensionalArrayToListConversionShouldConvertEntriesCorrectly () {
867
870
String [][] grid = new String [][] { new String [] { "1" , "2" , "3" , "4" }, new String [] { "5" , "6" , "7" , "8" },
868
871
new String [] { "9" , "10" , "11" , "12" } };
@@ -1035,7 +1038,6 @@ private static class ISBN {
1035
1038
1036
1039
static int constructorCount = 0 ;
1037
1040
static int toStringCount = 0 ;
1038
-
1039
1041
static int valueOfCount = 0 ;
1040
1042
1041
1043
static void reset () {
@@ -1046,7 +1048,7 @@ static void reset() {
1046
1048
1047
1049
private final String value ;
1048
1050
1049
- private ISBN (String value ) {
1051
+ public ISBN (String value ) {
1050
1052
constructorCount ++;
1051
1053
this .value = value ;
1052
1054
}
0 commit comments