use of org.mamute.model.AnswerInformation in project mamute by caelum.
the class InformationDAOTest method newPendingChangesAnswer.
private void newPendingChangesAnswer(Answer answer, int times) {
for (int i = 0; i < times; i++) {
AnswerInformation pendingInfo = new AnswerInformation(notMarked("info2 info2 info2 info2 info2 info2 info2 "), currentAuthor, answer, "new answer");
answer.enqueueChange(pendingInfo, PENDING);
}
}
use of org.mamute.model.AnswerInformation 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.AnswerInformation in project mamute by caelum.
the class AnswerTest method return_true_if_answer_has_pending_edits.
@Test
public void return_true_if_answer_has_pending_edits() throws Exception {
Question myQuestion = question.withTitle("question title").withDescription("description").withAuthor(author).build();
Answer answer = answer("blablablab", myQuestion, author);
assertFalse(answer.hasPendingEdits());
AnswerInformation approved = new AnswerInformation(notMarked("blablabalblab"), new LoggedUser(editUser, null), answer, "");
answer.enqueueChange(approved, PENDING);
assertTrue(answer.hasPendingEdits());
}
use of org.mamute.model.AnswerInformation in project mamute by caelum.
the class DaoManager method answerQuestion.
public Answer answerQuestion(User author, Question question, String description, boolean watching) {
this.session.beginTransaction();
LoggedUser loggedUser = new LoggedUser(author, null);
AnswerInformation information = new AnswerInformation(notMarked(description), loggedUser, "new answer");
Answer answer = new Answer(information, question, author);
this.answerDao.save(answer);
this.session.getTransaction().commit();
return answer;
}
Aggregations