Search in sources :

Example 6 with UserPersonalInfo

use of org.mamute.dto.UserPersonalInfo in project mamute by caelum.

the class UserPersonalInfoValidatorTest method should_not_validate_invalid_mail.

@Test
public void should_not_validate_invalid_mail() {
    User artur = user("artur com seis caracteres", validEmail);
    UserPersonalInfo info = new UserPersonalInfo(artur).withEmail("invalidEmail");
    assertFalse(infoValidator.validate(info));
}
Also used : User(org.mamute.model.User) UserPersonalInfo(org.mamute.dto.UserPersonalInfo) Test(org.junit.Test)

Example 7 with UserPersonalInfo

use of org.mamute.dto.UserPersonalInfo in project mamute by caelum.

the class UserPersonalInfoValidatorTest method should_validate_user_trying_to_update_name_after_allowed_time.

@Test
public void should_validate_user_trying_to_update_name_after_allowed_time() {
    User artur = user("artur com seis caracteres", validEmail);
    DateTimeUtils.setCurrentMillisFixed(new DateTime().plusDays(31).getMillis());
    UserPersonalInfo info = new UserPersonalInfo(artur).withName(fromTrustedText("newName")).withEmail(artur.getEmail());
    when(bundle.getMessage("date.joda.simple.pattern")).thenReturn("dd/MM/YYYY");
    assertTrue(infoValidator.validate(info));
}
Also used : User(org.mamute.model.User) UserPersonalInfo(org.mamute.dto.UserPersonalInfo) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Aggregations

UserPersonalInfo (org.mamute.dto.UserPersonalInfo)7 Test (org.junit.Test)6 User (org.mamute.model.User)5 DateTime (org.joda.time.DateTime)2 Post (br.com.caelum.vraptor.Post)1