1
1
/*
2
- * Copyright 2002-2013 the original author or authors.
2
+ * Copyright 2002-2014 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.
53
53
*/
54
54
public class DefaultConversionTests {
55
55
56
- private DefaultConversionService conversionService = new DefaultConversionService ();
56
+ private final DefaultConversionService conversionService = new DefaultConversionService ();
57
+
57
58
58
59
@ Test
59
60
public void testStringToCharacter () {
@@ -777,6 +778,16 @@ public char[] convert(String source) {
777
778
assertThat (converted , equalTo (new char [] { 'a' , 'b' , 'c' }));
778
779
}
779
780
781
+ @ Test
782
+ public void multidimensionalArrayToListConversionShouldConvertEntriesCorrectly () {
783
+ String [][] grid = new String [][] { new String [] { "1" , "2" , "3" , "4" }, new String [] { "5" , "6" , "7" , "8" },
784
+ new String [] { "9" , "10" , "11" , "12" } };
785
+ List <String []> converted = conversionService .convert (grid , List .class );
786
+ String [][] convertedBack = conversionService .convert (converted , String [][].class );
787
+ assertArrayEquals (grid , convertedBack );
788
+ }
789
+
790
+
780
791
public static class TestEntity {
781
792
782
793
private Long id ;
@@ -794,6 +805,7 @@ public static TestEntity findTestEntity(Long id) {
794
805
}
795
806
}
796
807
808
+
797
809
private static class ListWrapper {
798
810
799
811
private List <?> list ;
@@ -807,8 +819,10 @@ public List<?> getList() {
807
819
}
808
820
}
809
821
822
+
810
823
public Object assignableTarget ;
811
824
825
+
812
826
private static class SSN {
813
827
814
828
private String value ;
@@ -837,6 +851,7 @@ public String toString() {
837
851
}
838
852
}
839
853
854
+
840
855
private static class ISBN {
841
856
842
857
private String value ;
0 commit comments