@Test @SuppressWarnings("unchecked") public void testEvaluateNestedParentWithDifferentTypes() { graphHandler.removeChild(rootNode, parentNode); graphHandler.setChild(grandParentNode, parentNode); graphHandler.removeChild(parentNode, nodeA); graphHandler.setChild(grandParentNode, nodeA); when(connectionContext.getSource()).thenReturn(Optional.of(nodeA)); when(connectionContext.getTarget()).thenReturn(Optional.of(nodeB)); when(ruleExtension.getTypeArguments()).thenReturn(new Class[]{ParentDefinition.class}); RuleViolations violations = tested.evaluate(ruleExtension, connectionContext); assertViolations(violations, false); when(ruleExtension.getTypeArguments()).thenReturn( new Class[]{ParentDefinition.class, GrandParentDefinition.class}); violations = tested.evaluate(ruleExtension, connectionContext); assertViolations(violations, false); graphHandler.removeChild(parentNode, nodeB); graphHandler.setChild(grandParentNode, nodeB); violations = tested.evaluate(ruleExtension, connectionContext); assertViolations(violations, true); when(ruleExtension.getTypeArguments()).thenReturn( new Class[]{ParentDefinition.class, RootDefinition.class}); violations = tested.evaluate(ruleExtension, connectionContext); assertViolations(violations, true); }
@Override public RuleViolations evaluate(final RuleExtension rule, final GraphConnectionContext context) { return evaluateConnection(rule, context); }
ConnectorParentsMatchConnectionHandler extends AbstractParentsMatchHandler<ConnectorParentsMatchConnectionHandler, GraphConnectionContext> { @Override public RuleViolations evaluate(final RuleExtension rule, final GraphConnectionContext context) { return evaluateConnection(rule, context); } }
ConnectorParentsMatchConnectionHandler extends AbstractParentsMatchHandler<ConnectorParentsMatchConnectionHandler, GraphConnectionContext> { @Override public RuleViolations evaluate(final RuleExtension rule, final GraphConnectionContext context) { return evaluateConnection(rule, context); } protected  ConnectorParentsMatchConnectionHandler(); @Inject  ConnectorParentsMatchConnectionHandler(final DefinitionManager definitionManager); }
ConnectorParentsMatchConnectionHandler extends AbstractParentsMatchHandler<ConnectorParentsMatchConnectionHandler, GraphConnectionContext> { @Override public RuleViolations evaluate(final RuleExtension rule, final GraphConnectionContext context) { return evaluateConnection(rule, context); } protected  ConnectorParentsMatchConnectionHandler(); @Inject  ConnectorParentsMatchConnectionHandler(final DefinitionManager definitionManager); @Override Class<ConnectorParentsMatchConnectionHandler> getExtensionType(); @Override Class<GraphConnectionContext> getContextType(); @Override boolean accepts(final RuleExtension rule,
                           final GraphConnectionContext context); @Override RuleViolations evaluate(final RuleExtension rule,
                                   final GraphConnectionContext context); }
ConnectorParentsMatchConnectionHandler extends AbstractParentsMatchHandler<ConnectorParentsMatchConnectionHandler, GraphConnectionContext> { @Override public RuleViolations evaluate(final RuleExtension rule, final GraphConnectionContext context) { return evaluateConnection(rule, context); } protected  ConnectorParentsMatchConnectionHandler(); @Inject  ConnectorParentsMatchConnectionHandler(final DefinitionManager definitionManager); @Override Class<ConnectorParentsMatchConnectionHandler> getExtensionType(); @Override Class<GraphConnectionContext> getContextType(); @Override boolean accepts(final RuleExtension rule,
                           final GraphConnectionContext context); @Override RuleViolations evaluate(final RuleExtension rule,
                                   final GraphConnectionContext context);  }