### Question:
NodeDockingEvaluationHandler implements RuleEvaluationHandler<CanDock, NodeDockingContext> { @Override public boolean accepts(final CanDock rule, final NodeDockingContext context) { final Set<String> parentLabels = evalUtils.getLabels(context.getParent()); return dockingHandler.accepts(rule, RuleEvaluationContextBuilder.DomainContexts.docking(parentLabels, Collections.emptySet())); } protected  NodeDockingEvaluationHandler(); @Inject  NodeDockingEvaluationHandler(final DefinitionManager definitionManager,
                                        final DockingEvaluationHandler dockingHandler); @Override Class<CanDock> getRuleType(); @Override Class<NodeDockingContext> getContextType(); @Override boolean accepts(final CanDock rule,
                           final NodeDockingContext context); @Override RuleViolations evaluate(final CanDock rule,
                                   final NodeDockingContext context);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testAcceptSuccess() { when(context.getParent()).thenReturn(parent); when(context.getCandidate()).thenReturn(candidate); final boolean accepts = tested.accepts(RULE, context); assertTrue(accepts); }
@Test @SuppressWarnings("unchecked") public void testAcceptFailed() { when(context.getParent()).thenReturn(element); when(context.getCandidate()).thenReturn(candidate); final boolean accepts = tested.accepts(RULE, context); assertFalse(accepts); }