@Test public void testAccepts() { Set<String> roles = Collections.singleton(ROLE); when(context.getRoles()).thenReturn(roles); assertTrue(tested.accepts(RULE_NO_LIMIT, context)); roles = Collections.singleton("anotherTheRole"); when(context.getRoles()).thenReturn(roles); assertFalse(tested.accepts(RULE_NO_LIMIT, context)); }
@Override public boolean accepts(final Occurrences rule, final CardinalityContext context) { return context.getRoles().contains(rule.getRole()); }
CardinalityEvaluationHandler implements RuleEvaluationHandler<Occurrences, CardinalityContext> { @Override public boolean accepts(final Occurrences rule, final CardinalityContext context) { return context.getRoles().contains(rule.getRole()); } }
CardinalityEvaluationHandler implements RuleEvaluationHandler<Occurrences, CardinalityContext> { @Override public boolean accepts(final Occurrences rule, final CardinalityContext context) { return context.getRoles().contains(rule.getRole()); }  }
CardinalityEvaluationHandler implements RuleEvaluationHandler<Occurrences, CardinalityContext> { @Override public boolean accepts(final Occurrences rule, final CardinalityContext context) { return context.getRoles().contains(rule.getRole()); }  @Override Class<Occurrences> getRuleType(); @Override Class<CardinalityContext> getContextType(); @Override boolean accepts(final Occurrences rule,
                           final CardinalityContext context); @Override RuleViolations evaluate(final Occurrences rule,
                                   final CardinalityContext context); }
CardinalityEvaluationHandler implements RuleEvaluationHandler<Occurrences, CardinalityContext> { @Override public boolean accepts(final Occurrences rule, final CardinalityContext context) { return context.getRoles().contains(rule.getRole()); }  @Override Class<Occurrences> getRuleType(); @Override Class<CardinalityContext> getContextType(); @Override boolean accepts(final Occurrences rule,
                           final CardinalityContext context); @Override RuleViolations evaluate(final Occurrences rule,
                                   final CardinalityContext context);  }