use of org.mamute.model.User in project mamute by caelum.
the class SignupValidatorTest method should_verify_large_name.
@Test
public void should_verify_large_name() throws Exception {
when(users.existsWithEmail(VALID_EMAIL)).thenReturn(false);
String name = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
User user = user(name, VALID_EMAIL);
boolean valid = signupValidator.validate(user, VALID_PASSWORD, VALID_PASSWORD);
assertFalse(valid);
}
use of org.mamute.model.User in project mamute by caelum.
the class TagsValidatorTest method setup.
@Before
public void setup() {
environment = mock(Environment.class);
when(environment.get("tags.sanitizer.regex")).thenReturn("[a-zA-Z0-9-]");
messageFactory = new MessageFactory(bundle);
validator = new MockValidator();
tagsValidator = new TagsValidator(environment, validator, messageFactory);
User user = user("any", "any@brutal.com");
java = new Tag("java", "", user);
ruby = new Tag("ruby", "", user);
rails = new Tag("rails", "", user);
nonalpha = new Tag("java,mysql", "", user);
}
use of org.mamute.model.User in project mamute by caelum.
the class UserPersonalInfoValidatorTest method should_not_validate_user_trying_to_update_name_before_allowed_time.
@Test
public void should_not_validate_user_trying_to_update_name_before_allowed_time() {
User artur = user("artur com seis caracteres", validEmail);
UserPersonalInfo info = new UserPersonalInfo(artur).withName(fromTrustedText("newName")).withEmail(artur.getEmail());
when(bundle.getMessage("date.joda.simple.pattern")).thenReturn("dd/MM/YYYY");
assertFalse(infoValidator.validate(info));
}
use of org.mamute.model.User in project mamute by caelum.
the class UserPersonalInfoValidatorTest method should_pass_validation_with_not_required_elements_null.
@Test
public void should_pass_validation_with_not_required_elements_null() {
User artur = user("artur com seis caracteres", validEmail);
UserPersonalInfo info = new UserPersonalInfo(artur).withName(fromTrustedText(artur.getName())).withEmail(artur.getEmail());
assertTrue(infoValidator.validate(info));
}
use of org.mamute.model.User in project mamute by caelum.
the class UserPersonalInfoValidatorTest method should_not_validate_under_twelve_years_old_user.
@Test
public void should_not_validate_under_twelve_years_old_user() {
User artur = user("artur com seis caracteres", validEmail);
DateTime hoje = DateTime.now();
UserPersonalInfo info = new UserPersonalInfo(artur).withName(fromTrustedText(artur.getName())).withEmail(artur.getEmail()).withBirthDate(hoje);
assertFalse(infoValidator.validate(info));
}
Aggregations