user.setUsername(VALID_NAME);
user.setPassword(VALID_PASSWORD);
user.setConfirmPassword(VALID_PASSWORD);
user.setDefaultPageLayoutCode(VALID_PAGELAYOUT);
user.setEmail("existing@localhost");
Errors errors = new BindException(user, NEW_USER);
User user1 = createMock(User.class);
expect(mockUserService.getUserByUsername(VALID_NAME)).andReturn(null);
expect(mockUserService.getUserByEmail("existing@localhost")).andReturn(user1);
replay(mockUserService);
newAccountValidator.validate(user, errors);
assertEquals("1 Validation error", 1, errors.getErrorCount());
assertNotNull(errors.getFieldError(FIELD_EMAIL));
}