@Test @SuppressWarnings("unchecked") public void testEvaluate() { StatefulGraphEvaluationState.StatefulContainmentState containmentState = new StatefulGraphEvaluationState.StatefulContainmentState(); when(state.getContainmentState()).thenReturn(containmentState); Element parent = new NodeImpl<>("parent"); Node child = new NodeImpl<>("child"); final NodeContainmentContext[] containmentContext = new NodeContainmentContext[1]; tested.evaluate(builder -> containmentContext[0] = builder.containment(parent, child)); verify(ruleManager, times(1)).evaluate(eq(ruleSet), eq(containmentContext[0])); assertEquals(parent, containmentState.getParent(child)); }
@Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); }
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } }
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
                                                  final FactoryManager factoryManager,
                                                  final RuleManager ruleManager,
                                                  final Index<?, ?> graphIndex,
                                                  final RuleSet ruleSet);   ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
                                           final FactoryManager factoryManager,
                                           final RuleManager ruleManager,
                                           final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
                                           final Index<?, ?> graphIndex,
                                           final RuleSet ruleSet); }
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
                                                  final FactoryManager factoryManager,
                                                  final RuleManager ruleManager,
                                                  final Index<?, ?> graphIndex,
                                                  final RuleSet ruleSet);   ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
                                           final FactoryManager factoryManager,
                                           final RuleManager ruleManager,
                                           final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
                                           final Index<?, ?> graphIndex,
                                           final RuleSet ruleSet); void clear(); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
                                                  final FactoryManager factoryManager,
                                                  final RuleManager ruleManager,
                                                  final Index<?, ?> graphIndex,
                                                  final RuleSet ruleSet);   ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
                                           final FactoryManager factoryManager,
                                           final RuleManager ruleManager,
                                           final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
                                           final Index<?, ?> graphIndex,
                                           final RuleSet ruleSet); void clear(); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet();  }