}
public void testRegisteringProperty() throws Exception {
PropertyEditor pe;
DefaultPropertyEditorRegistry registry = new DefaultPropertyEditorRegistry();
registry.setPropertyEditor(A.class, "something", ClassEditor.class);
try {
registry.getPropertyEditor(B.class, "something");
fail("Should have thrown an IllegalArgumentException");
}
catch (IllegalArgumentException e) {
// should have been thrown
}
pe = registry.getPropertyEditor(E.class, "something");
assertNotNull(pe);
assertEquals(ClassEditor.class, pe.getClass());
pe = registry.getPropertyEditor(C.class, "something");
assertNotNull(pe);
assertEquals(ClassEditor.class, pe.getClass());
pe = registry.getPropertyEditor(B.class, "bar");
assertNotNull(pe);
registry.setPropertyEditor(Long.class, ClassEditor.class);
pe = registry.getPropertyEditor(B.class, "bar");
assertNotNull(pe);
assertEquals(ClassEditor.class, pe.getClass());
}