@Test public void incorrectEmail() { user = populateUser(); user.setUsername("Hi_Mom!"); userValidator.validate(user, errors); assertTrue(errors.hasErrors()); }
public User populateUser() { Date date = new Date(); User user = new User(); user.setUsername("aac" + date.getTime() + "@mailinator.com"); user.setPassword("darthVadar"); user.setConfirmPassword("darthVadar"); errors = new BeanPropertyBindingResult(user, "user"); return user; }