Search in sources :

Example 6 with InvisibleForUsersRule

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

the class InvisibleForUsersRuleTest method should_add_filter_if_user_is_not_logged_in.

@Test
public void should_add_filter_if_user_is_not_logged_in() {
    LoggedUser user = new LoggedUser(null, null);
    InvisibleForUsersRule invisibleForUsersRule = new InvisibleForUsersRule(user);
    invisibleForUsersRule.addFilter("x", criteria);
    verify(criteria, only()).add(Mockito.any(Criterion.class));
}
Also used : Criterion(org.hibernate.criterion.Criterion) LoggedUser(org.mamute.model.LoggedUser) InvisibleForUsersRule(org.mamute.dao.InvisibleForUsersRule) Test(org.junit.Test)

Example 7 with InvisibleForUsersRule

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

the class IndexSyncJob method generateUser.

private InvisibleForUsersRule generateUser() {
    User user = new User(fromTrustedText("System"), "system");
    LoggedUser loggedUser = new LoggedUser(user, null);
    return new InvisibleForUsersRule(loggedUser);
}
Also used : User(org.mamute.model.User) LoggedUser(org.mamute.model.LoggedUser) LoggedUser(org.mamute.model.LoggedUser) InvisibleForUsersRule(org.mamute.dao.InvisibleForUsersRule)

Aggregations

InvisibleForUsersRule (org.mamute.dao.InvisibleForUsersRule)7 LoggedUser (org.mamute.model.LoggedUser)7 Criterion (org.hibernate.criterion.Criterion)3 Before (org.junit.Before)3 Test (org.junit.Test)3 Tag (org.mamute.model.Tag)2 User (org.mamute.model.User)2 RetrieveKarmaDownvote (org.mamute.controllers.RetrieveKarmaDownvote)1 ReputationEventDAO (org.mamute.dao.ReputationEventDAO)1 VoteDAO (org.mamute.dao.VoteDAO)1 WatcherDAO (org.mamute.dao.WatcherDAO)1 SuspectMassiveVote (org.mamute.dto.SuspectMassiveVote)1 Answer (org.mamute.model.Answer)1 Question (org.mamute.model.Question)1 MassiveVote (org.mamute.model.vote.MassiveVote)1 VotingMachine (org.mamute.model.vote.VotingMachine)1 KarmaCalculator (org.mamute.reputation.rules.KarmaCalculator)1