Search in sources :

Example 6 with Flag

use of org.mamute.model.Flag in project mamute by caelum.

the class FlagTest method should_throw_exception_when_setting_reason_in_not_other_type.

@Test(expected = IllegalStateException.class)
public void should_throw_exception_when_setting_reason_in_not_other_type() {
    Flag flag = flag(FlagType.OBSOLETE, user("author", "author@brutal.com"));
    flag.setReason("blabla");
}
Also used : Flag(org.mamute.model.Flag) Test(org.junit.Test)

Example 7 with Flag

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

Aggregations

Flag (org.mamute.model.Flag)7 Test (org.junit.Test)4 Comment (org.mamute.model.Comment)2 User (org.mamute.model.User)2 SimpleBrutauthRules (br.com.caelum.brutauth.auth.annotations.SimpleBrutauthRules)1 Post (br.com.caelum.vraptor.Post)1 Question (org.mamute.model.Question)1 Flaggable (org.mamute.model.interfaces.Flaggable)1