@Test
    @LoadGraphWith(MODERN)
    @IgnoreEngine(TraversalEngine.Type.COMPUTER)
    public void g_V_outE_identity_inV_explain() {
        final TraversalExplanation explanation = get_g_V_outE_identity_inV_explain();
        if (explanation.getStrategyTraversals().stream().map(Pair::getValue0).filter(s -> s instanceof IdentityRemovalStrategy || s instanceof IncidentToAdjacentStrategy).count() == 2) {
            printTraversalForm(explanation.getOriginalTraversal());
            boolean beforeIncident = true;
            boolean beforeIdentity = true;
            for (final Pair<TraversalStrategy, Traversal.Admin<?, ?>> pair : explanation.getStrategyTraversals()) {
                if (pair.getValue0().getClass().equals(IncidentToAdjacentStrategy.class))
                    beforeIncident = false;
                if (pair.getValue0().getClass().equals(IdentityRemovalStrategy.class))
                    beforeIdentity = false;

                if (beforeIdentity)
                    assertEquals(1, TraversalHelper.getStepsOfClass(IdentityStep.class, pair.getValue1()).size());

                if (beforeIncident)
                    assertEquals(1, TraversalHelper.getStepsOfClass(EdgeVertexStep.class, pair.getValue1()).size());

                if (!beforeIdentity)
                    assertEquals(0, TraversalHelper.getStepsOfClass(IdentityStep.class, pair.getValue1()).size());

                if (!beforeIncident)
                    assertEquals(0, TraversalHelper.getStepsOfClass(EdgeVertexStep.class, pair.getValue1()).size());
            }
            assertFalse(beforeIncident);
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/ExplainTest.java