IN PROGRESS - issue SWF-720: Multiple checkboxes to Collection mapping

http://jira.springframework.org/browse/SWF-720
This commit is contained in:
Keith Donald
2008-06-23 14:23:46 +00:00
parent 301931e617
commit a5d1f726b2
2 changed files with 15 additions and 2 deletions

View File

@@ -45,7 +45,7 @@ public class GenericFormatterRegistryTests extends TestCase {
NumberFormatter percentFormatter = new NumberFormatter(BigDecimal.class);
percentFormatter.setPattern("00%");
registry.registerFormatter("percent", percentFormatter);
Formatter formatter = registry.getFormatter(Integer.class, "percent");
Formatter formatter = registry.getFormatter(BigDecimal.class, "percent");
assertEquals("35%", formatter.format(new BigDecimal(".35")));
BigDecimal value = (BigDecimal) formatter.parse("35%");
assertEquals(new BigDecimal(".35"), value);
@@ -60,6 +60,16 @@ public class GenericFormatterRegistryTests extends TestCase {
assertNotNull(formatter);
}
public void testRegisterCustomFormatterBogusClass() {
registry.registerFormatter("double", new NumberFormatter(Double.class));
try {
registry.getFormatter(Integer.class, "double");
fail("Should have failed");
} catch (IllegalArgumentException e) {
}
}
public interface CustomType {
public String getText();
}