### Question:
UserProfileController { @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, "userSecurityDto.currentUserPassword", new DefaultStringEditor(true)); binder.registerCustomEditor(String.class, "userSecurityDto.newUserPassword", new DefaultStringEditor(true)); binder.registerCustomEditor(String.class, "userSecurityDto.newUserPasswordConfirm", new DefaultStringEditor(true)); binder.registerCustomEditor(Integer.class, "userProfileDto.pageSize", new PageSizeEditor()); binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); binder.registerCustomEditor(String.class, "avatar", new DefaultAvatarEditor(imageService)); } @Autowired  UserProfileController(UserService userService,
                                 BreadcrumbBuilder breadcrumbBuilder,
                                 @Qualifier("avatarPreprocessor")
                                 ImageConverter imageConverter,
                                 PostService postService,
                                 UserContactsService contactsService,
                                 @Qualifier("avatarService") ImageService imageService,
                                 EntityToDtoConverter converter,
                                 RetryTemplate retryTemplate); @InitBinder void initBinder(WebDataBinder binder); @RequestMapping(value = "/user", method = RequestMethod.GET) ModelAndView showCurrentUserProfilePage(); @RequestMapping(value = {"/users/{editedUserId}/profile", "/users/{editedUserId}"}, method = RequestMethod.GET) ModelAndView showUserProfile(@PathVariable Long editedUserId); @RequestMapping(value = "/users/{editedUserId}/contacts", method = RequestMethod.GET) ModelAndView showUserContacts(@PathVariable Long editedUserId); @RequestMapping(value = "/users/{editedUserId}/notifications", method = RequestMethod.GET) ModelAndView showUserNotificationSettings(@PathVariable Long editedUserId); @RequestMapping(value = "/users/{editedUserId}/security", method = RequestMethod.GET) ModelAndView showUserSecuritySettings(@PathVariable Long editedUserId); @RequestMapping(value = "/users/*/profile", method = RequestMethod.POST) ModelAndView saveEditedProfile(@Valid @ModelAttribute(EDITED_USER) EditUserProfileDto editedProfileDto,
                                          BindingResult result, HttpServletResponse response); @RequestMapping(value = "/users/*/notifications", method = RequestMethod.POST) ModelAndView saveEditedNotifications(@Valid @ModelAttribute(EDITED_USER) EditUserProfileDto editedProfileDto,
                                                BindingResult result, HttpServletResponse response); @RequestMapping(value = "/users/*/security", method = RequestMethod.POST) ModelAndView saveEditedSecurity(@Valid @ModelAttribute(EDITED_USER) EditUserProfileDto editedProfileDto,
                                           BindingResult result, HttpServletResponse response,
                                           RedirectAttributes redirectAttributes); @RequestMapping(value = "/users/*/contacts", method = RequestMethod.POST) ModelAndView saveEditedContacts(@Valid @ModelAttribute(EDITED_USER) EditUserProfileDto editedProfileDto,
                                           BindingResult result, HttpServletResponse response); @RequestMapping(value = "/users/{id}/postList", method = RequestMethod.GET) ModelAndView showUserPostList(@PathVariable Long id,
                                         @RequestParam(value = "page", defaultValue = "1",
                                                 required = false) String page); @RequestMapping(value = "**/language", method = RequestMethod.GET) String saveUserLanguage(@RequestParam(value = "lang", defaultValue = "en") String lang,
                                   HttpServletResponse response, HttpServletRequest request); static final String SECURITY; static final String PROFILE; static final String NOTIFICATIONS; static final String CONTACTS; static final String EDIT_PROFILE; static final String EDITED_USER; static final String BREADCRUMB_LIST; static final String IS_PASSWORD_CHANGED_ATTRIB; }### Answer:
@Test public void testInitBinder() { when(userService.getCurrentUser()).thenReturn(getUser()); WebDataBinder binder = mock(WebDataBinder.class); profileController.initBinder(binder); verify(binder).registerCustomEditor(eq(String.class), any(StringTrimmerEditor.class)); }