@Test public void testAccepts() { Set<String> candidateRoles = Collections.singleton("role2"); Set<String> parentRoles = Collections.singleton(PARENT_ID); when(context.getParentRoles()).thenReturn(parentRoles); when(context.getCandidateRoles()).thenReturn(candidateRoles); assertTrue(tested.accepts(RULE, context)); parentRoles = Collections.singleton("anotherParent"); when(context.getParentRoles()).thenReturn(parentRoles); assertFalse(tested.accepts(RULE, context)); }
@Override public boolean accepts(final CanDock rule, final DockingContext context) { return context.getParentRoles().contains(rule.getRole()); }
DockingEvaluationHandler implements RuleEvaluationHandler<CanDock, DockingContext> { @Override public boolean accepts(final CanDock rule, final DockingContext context) { return context.getParentRoles().contains(rule.getRole()); } }
DockingEvaluationHandler implements RuleEvaluationHandler<CanDock, DockingContext> { @Override public boolean accepts(final CanDock rule, final DockingContext context) { return context.getParentRoles().contains(rule.getRole()); }  }
DockingEvaluationHandler implements RuleEvaluationHandler<CanDock, DockingContext> { @Override public boolean accepts(final CanDock rule, final DockingContext context) { return context.getParentRoles().contains(rule.getRole()); }  @Override Class<CanDock> getRuleType(); @Override Class<DockingContext> getContextType(); @Override boolean accepts(final CanDock rule,
                           final DockingContext context); @Override RuleViolations evaluate(final CanDock rule,
                                   final DockingContext context); }
DockingEvaluationHandler implements RuleEvaluationHandler<CanDock, DockingContext> { @Override public boolean accepts(final CanDock rule, final DockingContext context) { return context.getParentRoles().contains(rule.getRole()); }  @Override Class<CanDock> getRuleType(); @Override Class<DockingContext> getContextType(); @Override boolean accepts(final CanDock rule,
                           final DockingContext context); @Override RuleViolations evaluate(final CanDock rule,
                                   final DockingContext context);  }