|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* Copyright 2002-2014 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@ -53,7 +53,8 @@ import static org.junit.Assert.*; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DefaultConversionTests { |
|
|
|
public class DefaultConversionTests { |
|
|
|
|
|
|
|
|
|
|
|
private DefaultConversionService conversionService = new DefaultConversionService(); |
|
|
|
private final DefaultConversionService conversionService = new DefaultConversionService(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testStringToCharacter() { |
|
|
|
public void testStringToCharacter() { |
|
|
@ -777,6 +778,16 @@ public class DefaultConversionTests { |
|
|
|
assertThat(converted, equalTo(new char[] { 'a', 'b', 'c' })); |
|
|
|
assertThat(converted, equalTo(new char[] { 'a', 'b', 'c' })); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void multidimensionalArrayToListConversionShouldConvertEntriesCorrectly() { |
|
|
|
|
|
|
|
String[][] grid = new String[][] { new String[] { "1", "2", "3", "4" }, new String[] { "5", "6", "7", "8" }, |
|
|
|
|
|
|
|
new String[] { "9", "10", "11", "12" } }; |
|
|
|
|
|
|
|
List<String[]> converted = conversionService.convert(grid, List.class); |
|
|
|
|
|
|
|
String[][] convertedBack = conversionService.convert(converted, String[][].class); |
|
|
|
|
|
|
|
assertArrayEquals(grid, convertedBack); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class TestEntity { |
|
|
|
public static class TestEntity { |
|
|
|
|
|
|
|
|
|
|
|
private Long id; |
|
|
|
private Long id; |
|
|
@ -794,6 +805,7 @@ public class DefaultConversionTests { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class ListWrapper { |
|
|
|
private static class ListWrapper { |
|
|
|
|
|
|
|
|
|
|
|
private List<?> list; |
|
|
|
private List<?> list; |
|
|
@ -807,8 +819,10 @@ public class DefaultConversionTests { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Object assignableTarget; |
|
|
|
public Object assignableTarget; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class SSN { |
|
|
|
private static class SSN { |
|
|
|
|
|
|
|
|
|
|
|
private String value; |
|
|
|
private String value; |
|
|
@ -837,6 +851,7 @@ public class DefaultConversionTests { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class ISBN { |
|
|
|
private static class ISBN { |
|
|
|
|
|
|
|
|
|
|
|
private String value; |
|
|
|
private String value; |
|
|
|