use of org.mamute.model.Question in project mamute by caelum.
the class QuestionTest method should_remove_vote_values_and_update_vote_count.
@Test
public void should_remove_vote_values_and_update_vote_count() {
Question myQuestion = question.build();
assertEquals(0l, myQuestion.getVoteCount());
Vote firstVote = new Vote(null, VoteType.UP);
myQuestion.substitute(null, firstVote);
assertEquals(1l, myQuestion.getVoteCount());
myQuestion.substitute(firstVote, new Vote(null, VoteType.DOWN));
assertEquals(-1l, myQuestion.getVoteCount());
myQuestion.substitute(null, new Vote(null, VoteType.DOWN));
assertEquals(-2l, myQuestion.getVoteCount());
}
use of org.mamute.model.Question in project mamute by caelum.
the class QuestionTest method should_verify_if_is_visible_when_visible.
@Test
public void should_verify_if_is_visible_when_visible() {
Question shouldILiveForever = question.build();
boolean isVisibleForModerator = shouldILiveForever.isVisibleFor(null);
assertTrue(isVisibleForModerator);
}
use of org.mamute.model.Question in project mamute by caelum.
the class QuestionTest method should_verify_if_is_visible_for_null.
@Test
public void should_verify_if_is_visible_for_null() {
Question shouldILiveForever = question.build();
shouldILiveForever.remove();
boolean isVisibleForNull = shouldILiveForever.isVisibleFor(null);
assertFalse(isVisibleForNull);
}
use of org.mamute.model.Question in project mamute by caelum.
the class AnswerTest method should_return_that_answer_is_solution_or_not.
@Test
public void should_return_that_answer_is_solution_or_not() {
Question canILiveForever = question.build();
Answer yes = answer("Yes", canILiveForever, null);
assertFalse(yes.isSolution());
yes.markAsSolution();
assertTrue(yes.isSolution());
}
use of org.mamute.model.Question in project mamute by caelum.
the class QuestionDAOTest method should_not_ignore_invisible_ones_if_user_is_author.
@Test
public void should_not_ignore_invisible_ones_if_user_is_author() {
Question javaQuestion = javaQuestion();
assertContains(javaQuestion, questionsBeingAuthor);
javaQuestion.remove();
assertContains(javaQuestion, questionsBeingAuthor);
}
Aggregations