### Question:
UserListener { @EventHandler public void handleUserWithdrawPasswordChanged(WithdrawPasswordChangedEvent event) { UserEntry user = loadUser(event.getUserId(), event.getUsername()); if (user == null) { return; } user.setWithdrawPassword(event.getEncodedPassword()); userRepository.save(user); logger.info("user {} withdraw password changed, id {}", event.getUsername(), event.getUserId()); }  @EventHandler void handleUserCreated(UserCreatedEvent event); @EventHandler void handleUserPasswordChanged(PasswordChangedEvent event); @EventHandler void handleUserWithdrawPasswordCreated(WithdrawPasswordCreatedEvent event); @EventHandler void handleUserWithdrawPasswordChanged(WithdrawPasswordChangedEvent event); @EventHandler void handleUserInfoChanged(UserInfoChangedEvent event); @EventHandler void handleUserAdminInfoChanged(UserAdminInfoChangedEvent event); @EventHandler void handleUpdateNotification(NotificationSettingsUpdatedEvent event); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setUserRepository(UserQueryRepository userRepository);  }### Answer:
@Test public void testHandleUserWithdrawPasswordChanged() throws Exception { final UserId userId = new UserId(); final String operatingIp = "207.45.15.2"; final String password = "new withdraw password"; final String username = "buyerAbc"; final String email = "buyerAbc@163.com"; final Date time = currentTime(); final UserQueryRepository repository = mock(UserQueryRepository.class); UserEntry user = new UserEntry(); when(repository.findOne(eq(userId.toString()))).thenReturn(user); final WithdrawPasswordChangedEvent event = new WithdrawPasswordChangedEvent(userId, username, email, password, password, operatingIp, time); final UserListener listener = new UserListener(); listener.setUserRepository(repository); listener.handleUserWithdrawPasswordChanged(event); final ArgumentCaptor<UserEntry> captor = ArgumentCaptor.forClass(UserEntry.class); verify(repository).save(captor.capture()); final UserEntry userEntry = captor.getValue(); assertThat(userEntry, notNullValue()); assertThat(userEntry.getWithdrawPassword(), equalTo(password)); verify(repository).findOne(eq(userId.toString())); }