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);
}
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);
}
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);
}
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));
}
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());
}
Aggregations