use of org.mamute.model.Answer in project mamute by caelum.
the class InformationDAOTest method should_find_pending_answers_edits.
@Test
public void should_find_pending_answers_edits() {
Answer answer = answer("info1 info1 info1 info1 info1 info1 info1 ", question, author);
session.save(answer);
newPendingChangesAnswer(answer, 2);
ModeratableAndPendingHistory pendingByUpdatables = informations.pendingByUpdatables(Answer.class);
List<Information> pendingInfoForAnswer = pendingByUpdatables.pendingInfoFor(answer);
assertEquals(2, pendingInfoForAnswer.size());
}
use of org.mamute.model.Answer 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.Answer in project mamute by caelum.
the class QuestionTest method can_be_marked_as_solved_by_the_an_answer_that_is_mine.
@Test
public void can_be_marked_as_solved_by_the_an_answer_that_is_mine() {
Question shouldILiveForever = question.build();
Answer yes = answer("my answer", shouldILiveForever, null);
shouldILiveForever.markAsSolvedBy(yes);
assertEquals(yes, shouldILiveForever.getSolution());
}
use of org.mamute.model.Answer in project mamute by caelum.
the class QuestionTest method should_return_false_if_is__not_author.
@Test
public void should_return_false_if_is__not_author() throws Exception {
User author = user("Fernanda", "bla@bla.com", 1l);
User user = user("Chico", "bla@b.com", 2L);
Question question = question(author);
assertFalse(question.canMarkAsSolution(user));
Answer answer = answer("", question, author);
question.markAsSolvedBy(answer);
assertFalse(question.canMarkAsSolution(user));
}
use of org.mamute.model.Answer in project mamute by caelum.
the class RemoveSolutionFlaggedByModeratorTest method should_remove_solution_from_question.
@Test
public void should_remove_solution_from_question() throws Exception {
RemoveSolutionFlaggedByModerator action = new RemoveSolutionFlaggedByModerator(loggedModerator);
Question question = question(user);
Answer answer = answer("blabla", question, user);
answer.markAsSolution();
action.fire(answer);
assertFalse(answer.isSolution());
assertFalse(question.isSolved());
}
Aggregations