### Question:
UserCommandHandler { @CommandHandler public void handleChangeAdminInfoCommand(ChangeAdminInfoCommand command) { notNull(command.getUserId(), "userid should not be empty"); hasLength(command.getUserId().toString(), "user Id cannot be empty"); hasLength(command.getUsername(), "username should not be empty"); isTrue(command.isValid(), String.format("command %s is not validate", command)); User user = repository.load(command.getUserId()); if (user == null) { logger.warn("cannot find user {}", command.getUserId()); return; } user.editAdminInfo( command.getEmail(), command.getIdentifier(), command.getMobile(), command.getFirstName(), command.getLastName(), command.getRoles()); logger.info("userid {}, username {} has changed admin info {}!", command.getUserId(), command.getUsername(), command); }  @CommandHandler UserId handleCreateUser(CreateUserCommand command); @CommandHandler UserAccount handleAuthenticateUser(AuthenticateUserCommand command); @CommandHandler String handleForgetPassword(ForgetPasswordCommand command); @CommandHandler String handlePasswordReset(ResetPasswordCommand command); @CommandHandler void handleChangePassword(ChangePasswordCommand command); @CommandHandler void handleChangeWithdrawPasswordCommand(ChangeWithdrawPasswordCommand command); @CommandHandler void handleCreateWithdrawPasswordCommand(CreateWithdrawPasswordCommand command); @CommandHandler void handleUpdateNotificationCommand(UpdateNotificationSettingsCommand command); @CommandHandler void handleChangeInfoCommand(ChangeInfoCommand command); @CommandHandler void handleChangeAdminInfoCommand(ChangeAdminInfoCommand command); @Autowired @Qualifier("userRepository") void setRepository(Repository<User> userRepository); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setPasswordEncoder(PasswordEncoder passwordEncoder); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setUserPasswordResetRepository(UserPasswordResetRepository userPasswordResetRepository); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setUserRepository(UserQueryRepository userRepository); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setPasswordResetTokenGenerator(PasswordResetTokenGenerator passwordResetTokenGenerator); static List<String> DEFAULT_ROLES; }### Answer:
@Test public void testHandleChangeAdminInfoCommand() { final UserId aggregateIdentifier = new UserId(); final Date time = currentTime(); final String email = "buyer1@163.com"; final String username = "buyer1"; final String phone = "13232321"; final Identifier identifier = new Identifier(Identifier.Type.IDENTITY_CARD, "110101201101019252"); final List<String> roles = ImmutableList.of("user", "admin"); UserEntry userEntry = new UserEntry(); userEntry.setUsername(username); userEntry.setPrimaryKey(aggregateIdentifier.toString()); userEntry.setLastName("Buyer One"); userEntry.setFirstName("Mr"); userEntry.setIdentifier(identifier); when(userQueryRepository.findByUsername("buyer1")).thenReturn(userEntry); ChangeAdminInfoCommand command = new ChangeAdminInfoCommand(aggregateIdentifier, username, email, identifier, phone, "Mr", "Buyer One", roles); fixture.given(new UserCreatedEvent(aggregateIdentifier, "buyer1", "Mr", "Buyer One", identifier, email, passwordEncoder.encode("buyer1"), UserCommandHandler.DEFAULT_ROLES, time)) .when(command) .expectEvents( new UserAdminInfoChangedEvent( aggregateIdentifier, username, email, identifier, phone, "Mr", "Buyer One", roles)); }