Search in sources :

Example 1 with RemoveSolutionFlaggedByModerator

use of org.mamute.model.flag.RemoveSolutionFlaggedByModerator in project mamute by caelum.

the class RemoveSolutionFlaggedByModeratorTest method should_handle_answer_flagged_by_moderator.

@Test
public void should_handle_answer_flagged_by_moderator() {
    RemoveSolutionFlaggedByModerator action = new RemoveSolutionFlaggedByModerator(loggedModerator);
    assertTrue(action.shouldHandle(new AnswerChild()));
    assertTrue(action.shouldHandle(answer("blabla", question(null), null)));
}
Also used : RemoveSolutionFlaggedByModerator(org.mamute.model.flag.RemoveSolutionFlaggedByModerator) Test(org.junit.Test)

Example 2 with RemoveSolutionFlaggedByModerator

use of org.mamute.model.flag.RemoveSolutionFlaggedByModerator in project mamute by caelum.

the class RemoveSolutionFlaggedByModeratorTest method should_not_handle_flag_of_normal_user.

@Test
public void should_not_handle_flag_of_normal_user() {
    RemoveSolutionFlaggedByModerator action = new RemoveSolutionFlaggedByModerator(loggedUser);
    Flaggable flaggable = new AnswerChild();
    assertFalse(action.shouldHandle(flaggable));
}
Also used : RemoveSolutionFlaggedByModerator(org.mamute.model.flag.RemoveSolutionFlaggedByModerator) Flaggable(org.mamute.model.interfaces.Flaggable) Test(org.junit.Test)

Example 3 with RemoveSolutionFlaggedByModerator

use of org.mamute.model.flag.RemoveSolutionFlaggedByModerator 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());
}
Also used : Answer(org.mamute.model.Answer) RemoveSolutionFlaggedByModerator(org.mamute.model.flag.RemoveSolutionFlaggedByModerator) Question(org.mamute.model.Question) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 RemoveSolutionFlaggedByModerator (org.mamute.model.flag.RemoveSolutionFlaggedByModerator)3 Answer (org.mamute.model.Answer)1 Question (org.mamute.model.Question)1 Flaggable (org.mamute.model.interfaces.Flaggable)1