### Question:
ConnectorParentsMatchConnectionHandler extends AbstractParentsMatchHandler<ConnectorParentsMatchConnectionHandler, GraphConnectionContext> { @Override public boolean accepts(final RuleExtension rule, final GraphConnectionContext context) { return acceptsConnection(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);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testAccepts() { when(connectionContext.getSource()).thenReturn(Optional.of(nodeA)); when(connectionContext.getTarget()).thenReturn(Optional.of(nodeB)); when(ruleExtension.getTypeArguments()).thenReturn(new Class[]{ParentDefinition.class}); assertTrue(tested.accepts(ruleExtension, connectionContext)); }
@Test @SuppressWarnings("unchecked") public void testNotAccepts() { when(connectionContext.getSource()).thenReturn(Optional.of(nodeA)); when(connectionContext.getTarget()).thenReturn(Optional.of(nodeB)); when(ruleExtension.getId()).thenReturn("anyOtherId"); when(ruleExtension.getTypeArguments()).thenReturn(new Class[]{ParentDefinition.class}); assertFalse(tested.accepts(ruleExtension, connectionContext)); }