use of org.mamute.model.User in project mamute by caelum.
the class QuestionTest method should_verify_show_mark_as_solution_rules_for_author.
@Test
public void should_verify_show_mark_as_solution_rules_for_author() throws Exception {
User author = user("Fernanda", "bla@bla.com", 1l);
Question question = question(author);
assertFalse(question.canMarkAsSolution(author));
question.add(answer("", question, author));
assertTrue(question.canMarkAsSolution(author));
}
use of org.mamute.model.User in project mamute by caelum.
the class QuestionTest method should_verify_that_a_user_already_flagged_question.
@Test
public void should_verify_that_a_user_already_flagged_question() throws Exception {
Question q = question.build();
User author = user("author", "author@brutal.com", 1l);
User other = user("other", "other@brutal.com", 2l);
Flag flag = flag(FlagType.OTHER, author);
q.add(flag);
assertTrue(q.alreadyFlaggedBy(author));
assertFalse(q.alreadyFlaggedBy(other));
}
use of org.mamute.model.User in project mamute by caelum.
the class QuestionTest method should_verify_if_is_visible_for_author.
@Test
public void should_verify_if_is_visible_for_author() {
User author = user("leo", "leo@leo");
Question shouldILiveForever = question.withAuthor(author).build();
shouldILiveForever.remove();
boolean isVisibleForAuthor = shouldILiveForever.isVisibleFor(author);
assertTrue(isVisibleForAuthor);
}
use of org.mamute.model.User 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());
}
use of org.mamute.model.User in project mamute by caelum.
the class QuestionTest method should_be_touched_by_original_author_after_edit.
@Test
public void should_be_touched_by_original_author_after_edit() throws Exception {
User artur = user("artur", "artur@x.com");
artur.setId(1l);
Question comoFaz = question.withTitle("titulo").withDescription("descricao").withAuthor(artur).build();
User leo = user("leo", "leo@x.com");
leo.setId(2l);
QuestionInformation info = new QuestionInformationBuilder().with(leo).build();
comoFaz.updateWith(info, updater);
assertEquals(comoFaz.getLastTouchedBy().getId(), artur.getId());
}
Aggregations