Search in sources :

Example 1 with FlaggableDAO

use of org.mamute.dao.FlaggableDAO in project mamute by caelum.

the class FlaggableDAOTest method setup.

@Before
public void setup() {
    flaggedInvisible.remove();
    addFlags(commentWithOneFlag, 1, author);
    addFlags(commentWithTwo, 2, author);
    addFlags(flaggedInvisible, 2, author);
    session.save(author);
    session.save(anyone);
    session.save(commentWithTwo);
    session.save(flaggedInvisible);
    session.save(commentWithOneFlag);
    session.save(java);
    session.save(question);
    session.flush();
    flaggables = new FlaggableDAO(session, meta);
    questions = new QuestionDAO(session, new InvisibleForUsersRule(new LoggedUser(anyone, null)));
    List<Class<? extends Flaggable>> moderatableTypes = new ArrayList<>();
    moderatableTypes.add(Question.class);
    moderatableTypes.add(Answer.class);
    moderatableTypes.add(Comment.class);
    moderatableTypes.add(News.class);
    when(meta.getFlaggableTypes()).thenReturn(moderatableTypes);
}
Also used : FlaggableDAO(org.mamute.dao.FlaggableDAO) Flaggable(org.mamute.model.interfaces.Flaggable) ArrayList(java.util.ArrayList) LoggedUser(org.mamute.model.LoggedUser) Before(org.junit.Before)

Aggregations

ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 FlaggableDAO (org.mamute.dao.FlaggableDAO)1 LoggedUser (org.mamute.model.LoggedUser)1 Flaggable (org.mamute.model.interfaces.Flaggable)1