use of org.mamute.model.Question in project mamute by caelum.
the class QuestionTest method should_verify_if_is_visible_for_moderator.
@Test
public void should_verify_if_is_visible_for_moderator() {
Question shouldILiveForever = question.build();
shouldILiveForever.remove();
boolean isVisibleForModerator = shouldILiveForever.isVisibleFor(user("leo", "leo@leo").asModerator());
assertTrue(isVisibleForModerator);
}
use of org.mamute.model.Question 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.Question in project mamute by caelum.
the class InformationDAOTest method newQuestion.
private Question newQuestion(User author) {
Question question = new QuestionBuilder().withAuthor(author).withTag(java).build();
session.save(question);
return question;
}
use of org.mamute.model.Question 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());
}
use of org.mamute.model.Question in project mamute by caelum.
the class QuestionTest method should_set_author_only_once.
@Test
public void should_set_author_only_once() throws Exception {
Question q = question.build();
User original = user("original", "original@brutal.com");
q.setAuthor(original);
User other = user("other", "other@brutal.com");
q.setAuthor(other);
assertEquals(original, q.getAuthor());
}
Aggregations