Search in sources :

Example 26 with VRaptorTestResult

use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.

the class ListTest method should_list_by_tag.

@Test
public void should_list_by_tag() {
    String tag = "java";
    UserFlow navigation = tagList(tag);
    VRaptorTestResult tagList = navigation.execute();
    tagList.wasStatus(200).isValid();
    List<Question> questions = tagList.getObject("questions");
    boolean onlyTag = true;
    for (Question q : questions) {
        if (!q.getTagsAsString(" ").contains(tag)) {
            onlyTag = false;
            break;
        }
    }
    assertTrue(onlyTag);
}
Also used : UserFlow(br.com.caelum.vraptor.test.requestflow.UserFlow) Question(org.mamute.model.Question) VRaptorTestResult(br.com.caelum.vraptor.test.VRaptorTestResult) Test(org.junit.Test)

Example 27 with VRaptorTestResult

use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.

the class ListTest method should_not_show_questions_with_too_low_reputation.

@Test
public void should_not_show_questions_with_too_low_reputation() {
    UserFlow navigation = home();
    VRaptorTestResult home = navigation.execute();
    home.wasStatus(200).isInvalid();
    List<Question> questions = home.getObject("questions");
    boolean showLowReputation = false;
    for (Question q : questions) {
        if (q.getVoteCount() <= QuestionDAO.SPAM_BOUNDARY) {
            showLowReputation = true;
            break;
        }
    }
    assertFalse(showLowReputation);
}
Also used : UserFlow(br.com.caelum.vraptor.test.requestflow.UserFlow) Question(org.mamute.model.Question) VRaptorTestResult(br.com.caelum.vraptor.test.VRaptorTestResult) Test(org.junit.Test)

Example 28 with VRaptorTestResult

use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.

the class SignupTest method should_not_sign_up_with_a_short_password.

@Test
public void should_not_sign_up_with_a_short_password() {
    UserFlow navigation = signUp(navigate(), "Marco", randomEmail(), "123", "123");
    VRaptorTestResult notSignedUpUser = navigation.followRedirect().execute();
    notSignedUpUser.wasStatus(200).isValid();
    List<String> errorsList = errorsList(notSignedUpUser);
    assertTrue(errorsList.contains(message("signup.errors.password.length")));
}
Also used : UserFlow(br.com.caelum.vraptor.test.requestflow.UserFlow) VRaptorTestResult(br.com.caelum.vraptor.test.VRaptorTestResult) Test(org.junit.Test)

Aggregations

VRaptorTestResult (br.com.caelum.vraptor.test.VRaptorTestResult)28 UserFlow (br.com.caelum.vraptor.test.requestflow.UserFlow)27 Test (org.junit.Test)27 Question (org.mamute.model.Question)15 User (org.mamute.model.User)9 Elements (org.jsoup.select.Elements)5 Answer (org.mamute.model.Answer)5 LoggedUser (org.mamute.model.LoggedUser)4 ArrayList (java.util.ArrayList)3 AnswerAndVotes (org.mamute.model.AnswerAndVotes)3 DaoManager (org.mamute.integration.util.DaoManager)1 Tag (org.mamute.model.Tag)1