Search in sources :

Example 26 with Question

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

the class QuestionDAOTest method should_throw_constraint_exception_if_description_has_less_than_30_chars.

@Test(expected = ConstraintViolationException.class)
public void should_throw_constraint_exception_if_description_has_less_than_30_chars() {
    Question myQuestion = question.withTitle(VALID_TITLE).withDescription(INVALID_DESC).withAuthor(author).build();
    questionsBeingAuthor.save(myQuestion);
}
Also used : Question(org.mamute.model.Question) Test(org.junit.Test)

Example 27 with Question

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

the class QuestionDAOTest method should_throw_constraint_exception_if_title_has_less_than_15_chars.

@Test(expected = ConstraintViolationException.class)
public void should_throw_constraint_exception_if_title_has_less_than_15_chars() {
    Question myQuestion = question.withTitle(INVALID_TITLE).withDescription(VALID_DESC).withAuthor(author).build();
    questionsBeingAuthor.save(myQuestion);
}
Also used : Question(org.mamute.model.Question) Test(org.junit.Test)

Example 28 with Question

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

the class QuestionDAOTest method should_throw_constraint_exception_if_title_is_null.

@Test(expected = ConstraintViolationException.class)
public void should_throw_constraint_exception_if_title_is_null() {
    Question myQuestion = question.withTitle(null).withDescription(VALID_DESC).withAuthor(author).build();
    questionsBeingAuthor.save(myQuestion);
}
Also used : Question(org.mamute.model.Question) Test(org.junit.Test)

Example 29 with Question

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

the class QuestionDAOTest method should_return_only_questions_with_the_provided_tag.

@Test
public void should_return_only_questions_with_the_provided_tag() {
    Question javaQuestion = javaQuestion();
    Question javaEEQuestion = javaEEQuestion();
    Question androidQuestion = androidQuestion();
    List<Question> questionsAboutJava = questionsBeingAuthor.withTagVisible(java, 1);
    assertTrue(questionsAboutJava.contains(javaQuestion));
    assertFalse(questionsAboutJava.contains(javaEEQuestion));
    assertFalse(questionsAboutJava.contains(androidQuestion));
}
Also used : Question(org.mamute.model.Question) Test(org.junit.Test)

Example 30 with Question

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

the class QuestionDAOTest method should_find_questions_visible_and_order_by_creation_date_of_a_tag.

@Test
public void should_find_questions_visible_and_order_by_creation_date_of_a_tag() throws Exception {
    Question question1 = question(author, java);
    Question question2 = question(author, defaultTag);
    Question invisible = question(author, defaultTag);
    invisible.remove();
    session.save(question1);
    session.save(question2);
    session.save(invisible);
    List<RssContent> questions = questionsForAnyone.orderedByCreationDate(30, defaultTag);
    assertEquals(1, questions.size());
}
Also used : Question(org.mamute.model.Question) RssContent(org.mamute.model.interfaces.RssContent) Test(org.junit.Test)

Aggregations

Question (org.mamute.model.Question)96 Test (org.junit.Test)74 User (org.mamute.model.User)28 Answer (org.mamute.model.Answer)24 VRaptorTestResult (br.com.caelum.vraptor.test.VRaptorTestResult)15 UserFlow (br.com.caelum.vraptor.test.requestflow.UserFlow)15 Tag (org.mamute.model.Tag)9 ArrayList (java.util.ArrayList)8 QuestionBuilder (org.mamute.builder.QuestionBuilder)7 QuestionInformation (org.mamute.model.QuestionInformation)7 DateTime (org.joda.time.DateTime)6 LoggedUser (org.mamute.model.LoggedUser)5 QuestionInformationBuilder (org.mamute.model.QuestionInformationBuilder)5 Elements (org.jsoup.select.Elements)4 AnswerAndVotes (org.mamute.model.AnswerAndVotes)4 Comment (org.mamute.model.Comment)4 Get (br.com.caelum.vraptor.Get)3 Before (org.junit.Before)3 DaoManager (org.mamute.integration.util.DaoManager)3 AnswerInformation (org.mamute.model.AnswerInformation)3