Announcement Announcement Module
Collapse
No announcement yet.
Testing custom property editor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing custom property editor

    Hi All,
    I am new to Spring MVC and want to do unit testing for web components:

    I have registered a custom property editor using initBinder and want to test what class is getting registered, how can I do that

    Code:
         public void testInitDataBinder() throws Exception {
    	WebDataBinder binder = new ServletRequestDataBinder(null);
    	controller.initBinder(binder);
                 ........../ code to come here /
         }
    My Controller code is
    Code:
    protected void initBinder(WebDataBinder aWebDataBinder) throws Exception {
    aWebDataBinder.registerCustomEditor(MyClass.class, new MyPropertyEditor());
    }
    Thanks for your time.

    Albert

  • #2
    I think you can get the PropertyEditorRegistry from the DataBinder instance and check what's in it.

    Comment

    Working...
    X