@Test public void testAccept() { when(context.getDirection()).thenReturn(EdgeCardinalityContext.Direction.OUTGOING); assertFalse(tested.accepts(RULE_IN_MAX_1, context)); when(context.getDirection()).thenReturn(EdgeCardinalityContext.Direction.INCOMING); assertTrue(tested.accepts(RULE_IN_MAX_1, context)); when(context.getEdgeRole()).thenReturn("some-edge"); assertFalse(tested.accepts(RULE_IN_MAX_1, context)); when(context.getEdgeRole()).thenReturn(EDGE_ID); assertTrue(tested.accepts(RULE_IN_MAX_1, context)); when(context.getRoles()).thenReturn(Collections.singleton("some-role")); assertFalse(tested.accepts(RULE_IN_MAX_1, context)); }
@Override public boolean accepts(final EdgeOccurrences rule, final EdgeCardinalityContext context) { final EdgeCardinalityContext.Direction direction = rule.getDirection(); return context.getEdgeRole().equals(rule.getConnectorRole()) && direction.equals(context.getDirection()) && context.getRoles().contains(rule.getRole()); }
EdgeCardinalityEvaluationHandler implements RuleEvaluationHandler<EdgeOccurrences, EdgeCardinalityContext> { @Override public boolean accepts(final EdgeOccurrences rule, final EdgeCardinalityContext context) { final EdgeCardinalityContext.Direction direction = rule.getDirection(); return context.getEdgeRole().equals(rule.getConnectorRole()) && direction.equals(context.getDirection()) && context.getRoles().contains(rule.getRole()); } }
EdgeCardinalityEvaluationHandler implements RuleEvaluationHandler<EdgeOccurrences, EdgeCardinalityContext> { @Override public boolean accepts(final EdgeOccurrences rule, final EdgeCardinalityContext context) { final EdgeCardinalityContext.Direction direction = rule.getDirection(); return context.getEdgeRole().equals(rule.getConnectorRole()) && direction.equals(context.getDirection()) && context.getRoles().contains(rule.getRole()); }  }
EdgeCardinalityEvaluationHandler implements RuleEvaluationHandler<EdgeOccurrences, EdgeCardinalityContext> { @Override public boolean accepts(final EdgeOccurrences rule, final EdgeCardinalityContext context) { final EdgeCardinalityContext.Direction direction = rule.getDirection(); return context.getEdgeRole().equals(rule.getConnectorRole()) && direction.equals(context.getDirection()) && context.getRoles().contains(rule.getRole()); }  @Override Class<EdgeOccurrences> getRuleType(); @Override Class<EdgeCardinalityContext> getContextType(); @Override boolean accepts(final EdgeOccurrences rule,
                           final EdgeCardinalityContext context); @Override RuleViolations evaluate(final EdgeOccurrences rule,
                                   final EdgeCardinalityContext context); }
EdgeCardinalityEvaluationHandler implements RuleEvaluationHandler<EdgeOccurrences, EdgeCardinalityContext> { @Override public boolean accepts(final EdgeOccurrences rule, final EdgeCardinalityContext context) { final EdgeCardinalityContext.Direction direction = rule.getDirection(); return context.getEdgeRole().equals(rule.getConnectorRole()) && direction.equals(context.getDirection()) && context.getRoles().contains(rule.getRole()); }  @Override Class<EdgeOccurrences> getRuleType(); @Override Class<EdgeCardinalityContext> getContextType(); @Override boolean accepts(final EdgeOccurrences rule,
                           final EdgeCardinalityContext context); @Override RuleViolations evaluate(final EdgeOccurrences rule,
                                   final EdgeCardinalityContext context);  }