### Question:
PrivateMessageController { @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); } @Autowired  PrivateMessageController(PrivateMessageService pmService, BBCodeService bbCodeService,
                                    UserService userService); @InitBinder void initBinder(WebDataBinder binder); @RequestMapping(value = {"/inbox","/pm"}, method = RequestMethod.GET) ModelAndView inboxPage(@RequestParam(value = "page", defaultValue = "1", required = false) String page); @RequestMapping(value = "/outbox", method = RequestMethod.GET) ModelAndView outboxPage(@RequestParam(value = "page", defaultValue = "1", required = false) String page); @RequestMapping(value = "/drafts", method = RequestMethod.GET) ModelAndView draftsPage(@RequestParam(value = "page", defaultValue = "1", required = false) String page); @RequestMapping(value = "/pm/new", method = RequestMethod.GET) ModelAndView newPmPage(@RequestParam(value = "recipientId", required = false) Long recipientId); @RequestMapping(value = "/reply/{pmId}", method = RequestMethod.GET) ModelAndView replyPage(@PathVariable(PM_ID) Long id); @RequestMapping(value = "/quote/{pmId}", method = RequestMethod.GET) ModelAndView quotePage(@PathVariable(PM_ID) Long id); @RequestMapping(value = "/pm/new", method = RequestMethod.POST) ModelAndView sendMessage(@Valid @ModelAttribute PrivateMessageDto pmDto,
                                    BindingResult result); @RequestMapping(value = {"/pm/inbox/{pmId}", "/pm/outbox/{pmId}"}, method = RequestMethod.GET) ModelAndView showPmPage(@PathVariable(PM_ID) Long id); @RequestMapping(value = "/pm/drafts/{pmId}/edit", method = RequestMethod.GET) ModelAndView editDraftPage(@PathVariable(PM_ID) Long id); @RequestMapping(value = "/pm/save", method = {RequestMethod.POST, RequestMethod.GET}) ModelAndView saveDraft(@Valid @ModelAttribute("privateMessageDto") PrivateMessageDraftDto pmDto, BindingResult result); @RequestMapping(value = "/pm", method = {RequestMethod.DELETE}) String deleteMessages(@RequestParam(PM_IDENTIFIERS) List<Long> ids); static final String PM_IDENTIFIERS; }### Answer:
@Test public void testInitBinder() { WebDataBinder binder = mock(WebDataBinder.class); controller.initBinder(binder); verify(binder).registerCustomEditor(eq(String.class), any(StringTrimmerEditor.class)); }