git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2152 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Keith Donald
2009-10-19 00:13:30 +00:00
parent e3b0a642b1
commit ef5e79f47c
4 changed files with 110 additions and 94 deletions
@@ -63,6 +63,16 @@ public class GenericFormatterRegistryTests {
Integer i = (Integer) formatter.parse("3", Locale.US);
assertEquals(new Integer(3), i);
}
@Test
public void testAddLookupByPrimitive() throws ParseException {
registry.addFormatterByType(new IntegerFormatter());
Formatter formatter = registry.getFormatter(TypeDescriptor.valueOf(int.class));
String formatted = formatter.format(3, Locale.US);
assertEquals("3", formatted);
int integer = (Integer) formatter.parse("3", Locale.US);
assertEquals(3, integer);
}
@Test
public void testAddByObjectType() {