DatePropertyEditorRegistrar implements PropertyEditorRegistrar { @Override public void registerCustomEditors(PropertyEditorRegistry registry) { registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) dateFormat.clone(), false)); }  void setDateFormat(DateFormat dateFormat); @Override void registerCustomEditors(PropertyEditorRegistry registry);  }
@Test public void testRegisterCustomEditors01() throws Exception { DatePropertyEditorRegistrar registrar = new DatePropertyEditorRegistrar(); PropertyEditorRegistrar_PropertyEditorRegistryStub01 registry = new PropertyEditorRegistrar_PropertyEditorRegistryStub01(); registrar.registerCustomEditors(registry); assertSame(Date.class, registry.clazz); assertSame(CustomDateEditor.class, registry.editor.getClass()); SimpleDateFormat resultDateFormat = (SimpleDateFormat) ReflectionTestUtils .getField(registry.editor, "dateFormat"); assertSame("yyyy/MM/dd", ReflectionTestUtils.getField(resultDateFormat, "pattern")); }