@Test @SuppressWarnings("unchecked") public void testAcceptAllBut2() { when(handler1.accepts(eq(rule1), eq(context))).thenReturn(false); when(handler2.accepts(eq(rule1), eq(context))).thenReturn(true); final boolean accepts = tested.accepts(rule1, context); assertTrue(accepts); }
@Override @SuppressWarnings("unchecked") public boolean accepts(final RuleExtension rule, final RuleEvaluationContext context) { return handlers.stream().anyMatch(h -> isHandlerAccepted(h, rule, context)); }
RuleExtensionMultiHandler extends RuleExtensionHandler<RuleExtensionHandler, RuleEvaluationContext> { @Override @SuppressWarnings("unchecked") public boolean accepts(final RuleExtension rule, final RuleEvaluationContext context) { return handlers.stream().anyMatch(h -> isHandlerAccepted(h, rule, context)); } }
RuleExtensionMultiHandler extends RuleExtensionHandler<RuleExtensionHandler, RuleEvaluationContext> { @Override @SuppressWarnings("unchecked") public boolean accepts(final RuleExtension rule, final RuleEvaluationContext context) { return handlers.stream().anyMatch(h -> isHandlerAccepted(h, rule, context)); }  }
RuleExtensionMultiHandler extends RuleExtensionHandler<RuleExtensionHandler, RuleEvaluationContext> { @Override @SuppressWarnings("unchecked") public boolean accepts(final RuleExtension rule, final RuleEvaluationContext context) { return handlers.stream().anyMatch(h -> isHandlerAccepted(h, rule, context)); }  boolean addHandler(final RuleExtensionHandler handler); @Override Class<RuleExtensionHandler> getExtensionType(); @Override Class<RuleEvaluationContext> getContextType(); @Override @SuppressWarnings("unchecked") boolean accepts(final RuleExtension rule,
                           final RuleEvaluationContext context); @Override @SuppressWarnings("unchecked") RuleViolations evaluate(final RuleExtension rule,
                                   final RuleEvaluationContext context); }
RuleExtensionMultiHandler extends RuleExtensionHandler<RuleExtensionHandler, RuleEvaluationContext> { @Override @SuppressWarnings("unchecked") public boolean accepts(final RuleExtension rule, final RuleEvaluationContext context) { return handlers.stream().anyMatch(h -> isHandlerAccepted(h, rule, context)); }  boolean addHandler(final RuleExtensionHandler handler); @Override Class<RuleExtensionHandler> getExtensionType(); @Override Class<RuleEvaluationContext> getContextType(); @Override @SuppressWarnings("unchecked") boolean accepts(final RuleExtension rule,
                           final RuleEvaluationContext context); @Override @SuppressWarnings("unchecked") RuleViolations evaluate(final RuleExtension rule,
                                   final RuleEvaluationContext context);  }