improved conversion system logging, collection converter simplification/polish, several optimizations, annotation-driven formatting caching

This commit is contained in:
Keith Donald
2010-04-17 04:43:28 +00:00
parent bf1a95c771
commit 64d6a42dfd
23 changed files with 263 additions and 379 deletions

View File

@@ -56,7 +56,7 @@ public class TypeDescriptorTests {
assertTrue(typeDescriptor.isArray());
assertEquals(Integer.TYPE,typeDescriptor.getElementType());
}
@Test
public void complexTypeDescriptors() throws Exception {
TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("arrayOfListOfString"));

View File

@@ -39,19 +39,20 @@ public class GenericConversionServiceTests {
private GenericConversionService conversionService = new GenericConversionService();
@Test
public void executeConversion() {
public void convert() {
conversionService.addConverterFactory(new StringToNumberConverterFactory());
assertEquals(new Integer(3), conversionService.convert("3", Integer.class));
}
@Test
public void executeConversionNullSource() {
public void convertNullSource() {
assertEquals(null, conversionService.convert(null, Integer.class));
}
@Test
public void executeCompatibleSource() {
public void convertAssignableSource() {
assertEquals(Boolean.FALSE, conversionService.convert(false, boolean.class));
assertEquals(Boolean.FALSE, conversionService.convert(false, Boolean.class));
}
@Test
@@ -189,7 +190,7 @@ public class GenericConversionServiceTests {
input.put("key", "value");
Object converted = conversionService.convert(input, TypeDescriptor.forObject(input),
new TypeDescriptor(getClass().getField("wildcardMap")));
assertSame(input, converted);
assertEquals(input, converted);
}