final UserForm User = new UserForm();
final BindingResult errors = createNiceMock(BindingResult.class);
final String username = "canonical"; //specified username already exists in database
final String password = "password";
final String confirmPassword = password;
final org.apache.rave.model.User existingUser = new UserImpl();
List<ObjectError> errorList = new ArrayList<ObjectError>();
final ObjectError error = new ObjectError("username.exists", "Username already exists");
User.setUsername(username);
User.setPassword(password);
User.setConfirmPassword(confirmPassword);
existingUser.setUsername(username);
existingUser.setPassword(password);
errorList.add(error);
expect(errors.hasErrors()).andReturn(true).anyTimes();