This commit is contained in:
Keith Donald
2009-10-19 00:13:30 +00:00
parent 0e4064fecc
commit 2fe6003923
4 changed files with 110 additions and 94 deletions

View File

@@ -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() {