MessagePassingReductionStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy { public static MessagePassingReductionStrategy instance() { return INSTANCE; } private  MessagePassingReductionStrategy(); @Override void apply(final Traversal.Admin<?, ?> traversal); static final boolean endsWithElement(Step<?, ?> currentStep); @Override Set<Class<? extends OptimizationStrategy>> applyPrior(); static MessagePassingReductionStrategy instance();  }
@Test public void doTest() { final Traversal.Admin<?, ?> rootTraversal = new DefaultGraphTraversal<>(); final TraversalVertexProgramStep parent = new TraversalVertexProgramStep(rootTraversal, this.original.asAdmin()); rootTraversal.addStep(parent.asStep()); parent.setComputerTraversal(this.original.asAdmin()); final TraversalStrategies strategies = new DefaultTraversalStrategies(); strategies.addStrategies(MessagePassingReductionStrategy.instance()); for (final TraversalStrategy strategy : this.otherStrategies) { strategies.addStrategies(strategy); } rootTraversal.setStrategies(strategies); rootTraversal.asAdmin().applyStrategies(); assertEquals(this.optimized, parent.computerTraversal.get()); }