private void testEachTraversal(final Traversal.Admin<?, ?> traversal) {
        for (final Step step : traversal.getSteps()) {
            assertTrue(StepPosition.isStepId(step.getId()));
            if (step instanceof SideEffectCapable) {
                assertFalse(StepPosition.isStepId(((SideEffectCapable) step).getSideEffectKey()));
            }
            if (step instanceof Scoping) {
                ((Scoping) step).getScopeKeys().forEach(key -> assertFalse(StepPosition.isStepId(key)));
            }
            if (step instanceof TraversalParent) {
                ((TraversalParent) step).getLocalChildren().forEach(this::testEachTraversal);
                ((TraversalParent) step).getGlobalChildren().forEach(this::testEachTraversal);
            }
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/util/StepPositionTest.java