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