use of org.mamute.model.QuestionInformation in project mamute by caelum.
the class UpdaterTest method should_be_pending_if_is_not_author.
@Test
public void should_be_pending_if_is_not_author() {
User user = user("chico", "chico@gmail.com", nextId());
QuestionInformation newInformation = new QuestionInformation("title", notMarked("description"), new LoggedUser(user, null));
UpdateStatus update = updater.update(myQuestion, newInformation);
assertEquals(UpdateStatus.PENDING, update);
assertTrue(myQuestion.getHistory().contains(newInformation));
}
use of org.mamute.model.QuestionInformation in project mamute by caelum.
the class QuestionBuilder method build.
public Question build() {
QuestionInformation questionInformation = informationBuilder.withTitle(title).withDescription(description).with(author).withTags(tags).withComment(comment).build();
Question q = new Question(questionInformation, author);
setId(q, id);
clear();
return q;
}
use of org.mamute.model.QuestionInformation in project mamute by caelum.
the class InformationDAOTest method newChangesWithStatus.
private void newChangesWithStatus(Question question, int times, UpdateStatus status) {
for (int i = 0; i < times; i++) {
QuestionInformation questionInfo = new QuestionInformationBuilder().withTag(java).with(author).build();
question.enqueueChange(questionInfo, status);
}
}
use of org.mamute.model.QuestionInformation in project mamute by caelum.
the class QuestionInformationTest method should_verify_if_is_not_before_current_information.
@Test
public void should_verify_if_is_not_before_current_information() throws InterruptedException {
QuestionInformation infoByModerator = builder.build();
ruby.approve(infoByModerator);
Thread.sleep(100);
QuestionInformation version = builder.build();
ruby.enqueueChange(version, PENDING);
assertFalse(version.isBeforeCurrent());
}
use of org.mamute.model.QuestionInformation in project mamute by caelum.
the class QuestionTest method should_update_information_and_tag_usage_count.
@Test
public void should_update_information_and_tag_usage_count() throws Exception {
Tag ruby = tag("ruby");
Tag java = tag("java");
Question q = question.withTag(ruby).build();
QuestionInformation approved = new QuestionInformationBuilder().withTag(java).build();
q.updateApproved(approved);
assertEquals(0l, ruby.getUsageCount().longValue());
assertEquals(1l, java.getUsageCount().longValue());
}
Aggregations