Search in sources :

Example 91 with User

use of org.mamute.model.User in project mamute by caelum.

the class SignupValidatorTest method should_verify_if_exists_user_with_same_name.

@Test
public void should_verify_if_exists_user_with_same_name() throws Exception {
    String name = "existentName";
    when(users.existsWithName(name)).thenReturn(true);
    User user = user(name, VALID_EMAIL);
    boolean valid = signupValidator.validate(user, VALID_PASSWORD, VALID_PASSWORD);
    assertFalse(valid);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Example 92 with User

use of org.mamute.model.User in project mamute by caelum.

the class SignupValidatorTest method should_valid_user.

@Test
public void should_valid_user() throws Exception {
    User user = user(VALID_USER_NAME, VALID_EMAIL);
    boolean valid = signupValidator.validate(user, VALID_PASSWORD, VALID_PASSWORD);
    assertTrue(valid);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Example 93 with User

use of org.mamute.model.User in project mamute by caelum.

the class SignupValidatorTest method should_verify_email.

@Test
public void should_verify_email() {
    when(users.existsWithEmail("used@gmail.com")).thenReturn(true);
    User user = user(VALID_USER_NAME, "used@gmail.com");
    boolean valid = signupValidator.validate(user, VALID_PASSWORD, VALID_PASSWORD);
    assertFalse(valid);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Example 94 with User

use of org.mamute.model.User in project mamute by caelum.

the class SignupValidatorTest method should_verify_tiny_password.

@Test
public void should_verify_tiny_password() throws Exception {
    when(users.existsWithEmail(VALID_EMAIL)).thenReturn(false);
    User user = user(VALID_USER_NAME, VALID_EMAIL);
    boolean valid = signupValidator.validate(user, "12", "12");
    assertFalse(valid);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Example 95 with User

use of org.mamute.model.User 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)

Aggregations

User (org.mamute.model.User)97 Test (org.junit.Test)56 Question (org.mamute.model.Question)28 LoggedUser (org.mamute.model.LoggedUser)25 VRaptorTestResult (br.com.caelum.vraptor.test.VRaptorTestResult)9 UserFlow (br.com.caelum.vraptor.test.requestflow.UserFlow)9 Answer (org.mamute.model.Answer)9 LoginMethod (org.mamute.model.LoginMethod)9 Post (br.com.caelum.vraptor.Post)7 Before (org.junit.Before)7 Tag (org.mamute.model.Tag)7 QuestionInformation (org.mamute.model.QuestionInformation)6 Email (org.apache.commons.mail.Email)5 UserPersonalInfo (org.mamute.dto.UserPersonalInfo)5 ReputationEvent (org.mamute.model.ReputationEvent)5 ArrayList (java.util.ArrayList)4 Watcher (org.mamute.model.watch.Watcher)4 DateTime (org.joda.time.DateTime)3 Elements (org.jsoup.select.Elements)3 DaoManager (org.mamute.integration.util.DaoManager)3