### Question:
ConnectorParentsMatchContainmentHandler extends AbstractParentsMatchHandler<ConnectorParentsMatchContainmentHandler, NodeContainmentContext> { @Override @SuppressWarnings("unchecked") public boolean accepts(final RuleExtension rule, final NodeContainmentContext context) { final Collection<Node<? extends Definition<?>, ? extends Edge>> candidates = context.getCandidates(); return candidates.stream() .anyMatch(node -> hasAnyEdgeOfInterest(node, rule.getId())); } protected  ConnectorParentsMatchContainmentHandler(); @Inject  ConnectorParentsMatchContainmentHandler(final DefinitionManager definitionManager,
                                                   final TreeWalkTraverseProcessor treeWalkTraverseProcessor); @Override Class<ConnectorParentsMatchContainmentHandler> getExtensionType(); @Override Class<NodeContainmentContext> getContextType(); @Override @SuppressWarnings("unchecked") boolean accepts(final RuleExtension rule,
                           final NodeContainmentContext context); @Override RuleViolations evaluate(final RuleExtension rule,
                                   final NodeContainmentContext context);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testAccepts() { when(ruleExtension.getTypeArguments()).thenReturn(new Class[]{ParentDefinition.class}); when(containmentContext.getCandidates()).thenReturn(candidates); when(containmentContext.getParent()).thenReturn(parentNode); graphHandler.addEdge(connector, nodeA) .connectTo(connector, nodeB); assertTrue(tested.accepts(ruleExtension, containmentContext)); }
@Test @SuppressWarnings("unchecked") public void testNotAccepts() { when(ruleExtension.getTypeArguments()).thenReturn(new Class[]{DefinitionC.class}); when(containmentContext.getCandidates()).thenReturn(candidates); when(containmentContext.getParent()).thenReturn(parentNode); assertFalse(tested.accepts(ruleExtension, containmentContext)); }