### Question:
NodeContainmentEvaluationHandler implements RuleEvaluationHandler<CanContain, NodeContainmentContext> { @Override public boolean accepts(final CanContain rule, final NodeContainmentContext context) { final Set<String> parenteLabels = evalUtils.getLabels(context.getParent()); return containmentHandler.accepts(rule, RuleEvaluationContextBuilder.DomainContexts.containment(parenteLabels, Collections.emptySet())); } protected  NodeContainmentEvaluationHandler(); @Inject  NodeContainmentEvaluationHandler(final DefinitionManager definitionManager,
                                            final ContainmentEvaluationHandler containmentHandler); @Override Class<CanContain> getRuleType(); @Override Class<NodeContainmentContext> getContextType(); @Override boolean accepts(final CanContain rule,
                           final NodeContainmentContext context); @Override @SuppressWarnings("unchecked") RuleViolations evaluate(final CanContain rule,
                                   final NodeContainmentContext context);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testAcceptSuccess() { when(context.getParent()).thenReturn(element); when(context.getCandidates()).thenReturn(candidates); final boolean accepts = tested.accepts(RULE, context); assertTrue(accepts); }
@Test @SuppressWarnings("unchecked") public void testAcceptFailed() { when(context.getParent()).thenReturn(parent); when(context.getCandidates()).thenReturn(candidates); final boolean accepts = tested.accepts(RULE, context); assertFalse(accepts); }