@@ -247,32 +247,7 @@ public void testEnumToString() {
247247 @ Test
248248 public void testStringToEnumSet () throws Exception {
249249 assertEquals (EnumSet .of (Foo .BAR ), conversionService .convert ("BAR" , TypeDescriptor .valueOf (String .class ),
250- new TypeDescriptor (getClass ().getField ("enumSet" ))));
251- }
252-
253- public EnumSet <Foo > enumSet ;
254-
255-
256- public enum Foo {
257- BAR , BAZ
258- }
259-
260- public enum SubFoo {
261-
262- BAR {
263- @ Override
264- String s () {
265- return "x" ;
266- }
267- },
268- BAZ {
269- @ Override
270- String s () {
271- return "y" ;
272- }
273- };
274-
275- abstract String s ();
250+ new TypeDescriptor (getClass ().getField ("enumSet" ))));
276251 }
277252
278253 @ Test
@@ -344,8 +319,6 @@ public void convertArrayToCollectionInterface() {
344319 assertEquals ("3" , result .get (2 ));
345320 }
346321
347- public List <Integer > genericList = new ArrayList <Integer >();
348-
349322 @ Test
350323 public void convertArrayToCollectionGenericTypeConversion () throws Exception {
351324 @ SuppressWarnings ("unchecked" )
@@ -356,8 +329,6 @@ public void convertArrayToCollectionGenericTypeConversion() throws Exception {
356329 assertEquals (new Integer ("3" ), result .get (2 ));
357330 }
358331
359- public Stream <Integer > genericStream ;
360-
361332 @ Test
362333 public void convertArrayToStream () throws Exception {
363334 String [] source = {"1" , "3" , "4" };
@@ -381,15 +352,6 @@ public void testSpr7766() throws Exception {
381352 assertEquals (Color .BLACK , colors .get (1 ));
382353 }
383354
384- public class ColorConverter implements Converter <String , Color > {
385- @ Override
386- public Color convert (String source ) { if (!source .startsWith ("#" )) source = "#" + source ; return Color .decode (source ); }
387- }
388-
389- public void handlerMethod (List <Color > color ) {
390-
391- }
392-
393355 @ Test
394356 public void convertArrayToCollectionImpl () {
395357 LinkedList <?> result = conversionService .convert (new String [] { "1" , "2" , "3" }, LinkedList .class );
@@ -400,7 +362,7 @@ public void convertArrayToCollectionImpl() {
400362
401363 @ Test (expected = ConversionFailedException .class )
402364 public void convertArrayToAbstractCollection () {
403- conversionService .convert (new String [] { "1" , "2" , "3" }, AbstractList .class );
365+ conversionService .convert (new String []{ "1" , "2" , "3" }, AbstractList .class );
404366 }
405367
406368 public static enum FooEnum {
@@ -599,7 +561,7 @@ public ListWrapper convert(List source) {
599561 }
600562
601563 @ Test
602- @ SuppressWarnings ({ "cast" , " unchecked" } )
564+ @ SuppressWarnings (" unchecked" )
603565 public void convertObjectToCollection () {
604566 List <String > result = (List <String >) conversionService .convert (3L , List .class );
605567 assertEquals (1 , result .size ());
@@ -635,7 +597,7 @@ public void convertArrayToPrimitiveArray() {
635597 public void convertArrayToWrapperArray () {
636598 byte [] byteArray = new byte [] {1 , 2 , 3 };
637599 Byte [] converted = conversionService .convert (byteArray , Byte [].class );
638- assertThat (converted , equalTo (new Byte [] {1 , 2 , 3 }));
600+ assertThat (converted , equalTo (new Byte []{1 , 2 , 3 }));
639601 }
640602
641603 @ Test
@@ -693,7 +655,7 @@ public void convertCollectionToCollectionNotGeneric() throws Exception {
693655 }
694656
695657 @ Test
696- @ SuppressWarnings ({ "unchecked" , "rawtypes" })
658+ @ SuppressWarnings ({"unchecked" , "rawtypes" })
697659 public void convertCollectionToCollectionSpecialCaseSourceImpl () throws Exception {
698660 Map map = new LinkedHashMap ();
699661 map .put ("1" , "1" );
@@ -720,8 +682,6 @@ public void collection() {
720682 assertEquals (new Integer (9 ), integers .get (1 ));
721683 }
722684
723- public Map <Integer , FooEnum > genericMap = new HashMap <Integer , FooEnum >();
724-
725685 @ Test
726686 public void convertMapToMap () throws Exception {
727687 Map <String , String > foo = new HashMap <String , String >();
@@ -735,7 +695,7 @@ public void convertMapToMap() throws Exception {
735695 }
736696
737697 @ Test
738- @ SuppressWarnings ({ "rawtypes" } )
698+ @ SuppressWarnings ("rawtypes" )
739699 public void convertHashMapValuesToList () {
740700 Map <String , Integer > hashMap = new LinkedHashMap <String , Integer >();
741701 hashMap .put ("1" , 1 );
@@ -877,7 +837,7 @@ public void convertCharArrayToString() throws Exception {
877837 @ Test
878838 public void convertStringToCharArray () throws Exception {
879839 char [] converted = conversionService .convert ("a,b,c" , char [].class );
880- assertThat (converted , equalTo (new char [] {'a' , 'b' , 'c' }));
840+ assertThat (converted , equalTo (new char []{'a' , 'b' , 'c' }));
881841 }
882842
883843 @ Test
@@ -960,6 +920,54 @@ public void testPerformance1() {
960920 }
961921
962922
923+ // test fields and helpers
924+
925+ public List <Integer > genericList = new ArrayList <Integer >();
926+
927+ public Stream <Integer > genericStream ;
928+
929+ public Map <Integer , FooEnum > genericMap = new HashMap <Integer , FooEnum >();
930+
931+ public EnumSet <Foo > enumSet ;
932+
933+ public Object assignableTarget ;
934+
935+
936+ public void handlerMethod (List <Color > color ) {
937+ }
938+
939+
940+ public enum Foo {
941+ BAR , BAZ
942+ }
943+
944+
945+ public enum SubFoo {
946+
947+ BAR {
948+ @ Override
949+ String s () {
950+ return "x" ;
951+ }
952+ },
953+ BAZ {
954+ @ Override
955+ String s () {
956+ return "y" ;
957+ }
958+ };
959+
960+ abstract String s ();
961+ }
962+
963+
964+ public class ColorConverter implements Converter <String , Color > {
965+
966+ @ Override
967+ public Color convert (String source ) { if (!source .startsWith ("#" )) source = "#" + source ; return Color .decode (source ); }
968+ }
969+
970+
963971 @ SuppressWarnings ("serial" )
964972 public static class CustomNumber extends Number {
965973
@@ -1020,9 +1028,6 @@ public List<?> getList() {
10201028 }
10211029
10221030
1023- public Object assignableTarget ;
1024-
1025-
10261031 private static class SSN {
10271032
10281033 static int constructorCount = 0 ;
0 commit comments