use of org.mamute.model.Answer in project mamute by caelum.
the class InformationDAOTest method should_get_pending_count.
@Test
public void should_get_pending_count() {
Answer answer = answer("info1 info1 info1 info1 info1 info1 info1 ", question, author);
session.save(answer);
newPendingChangesAnswer(answer, 2);
newChangesWithStatus(question, 3, PENDING);
Long count = informations.pendingCount();
assertEquals(5l, count.longValue());
}
use of org.mamute.model.Answer in project mamute by caelum.
the class RetrieveKarmaTest method should_not_handle_answer_without_moderator.
@Test
public void should_not_handle_answer_without_moderator() {
Answer answer = answer(null, question, null);
assertFalse(retrieveKarmaWithoutModerator.shouldHandle(answer));
}
use of org.mamute.model.Answer in project mamute by caelum.
the class AnswerAndVotesTest method should_fill_value_with_null_only_answers_that_has_no_currentUserVote.
@Test
public void should_fill_value_with_null_only_answers_that_has_no_currentUserVote() {
Question q = question.build();
Object[] first = new Object[] { answerFor(q, 1), mock(Vote.class) };
Object[] second = new Object[] { answerFor(q, 2), mock(Vote.class) };
Answer third = answerFor(q, 3);
List<Object[]> voteList = new ArrayList<>();
voteList.add(first);
voteList.add(second);
List<Answer> answers = new ArrayList<>();
answers.add((Answer) first[0]);
answers.add((Answer) second[0]);
answers.add(third);
AnswerAndVotes votes = new AnswerAndVotes(q, answers, voteList);
Map<Answer, Vote> map = votes.getVotes();
assertEquals(first[1], map.get(first[0]));
assertEquals(second[1], map.get(second[0]));
assertEquals(null, map.get(third));
assertTrue(map.containsKey(third));
}
use of org.mamute.model.Answer in project mamute by caelum.
the class AnswerTest method should_approve_answer_info.
@Test
public void should_approve_answer_info() throws Exception {
Question myQuestion = question.withTitle("question title").withDescription("description").withAuthor(author).build();
Answer answer = answer("blablablab", myQuestion, author);
Information approved = new AnswerInformation(notMarked("blablabalblab"), new LoggedUser(editUser, null), answer, "");
answer.approve(approved);
assertEquals(approved, answer.getInformation());
assertEquals(editUser, answer.getLastTouchedBy());
}
use of org.mamute.model.Answer in project mamute by caelum.
the class AnswerTest method should_mark_question_as_solved.
@Test
public void should_mark_question_as_solved() {
Question canILiveForever = question.build();
Answer yes = answer("Yes", canILiveForever, null);
assertEquals(null, canILiveForever.getSolution());
yes.markAsSolution();
assertEquals(yes, canILiveForever.getSolution());
}
Aggregations