@Parameterized.Parameters(name = "{0}")
    public static Iterable<Object[]> generateTestParameters() {

        final List<Object[]> originalAndOptimized = new ArrayList<>();
        final GraphTraversal[] baseTraversals = new GraphTraversal[]{
                __.aggregate("x"),
                __.dedup(),
                __.dedup("a"),
                __.group(),
                __.group("x"),
                __.groupCount(),
                __.groupCount("x"),
                __.order(),
                __.order(Scope.local),
                __.project("a"),
                __.path(),
                __.path().from("a").to("b"),
                __.sack(assign),
                __.sample(10),
                __.select("a"),
                __.select("a", "b"),
                __.store("x"),
                __.tree(),
                __.tree("x"),
                __.where(P.eq("a")),
                __.where("a", P.eq("b"))
        };

        for (final Traversal traversal : baseTraversals) {
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(values("name")),
                    ((GraphTraversal) traversal.asAdmin().clone()).by("name"),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.id()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.id),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.label()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.label),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.key()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.key),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.value()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.value),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.identity()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(),
            });
        }

        originalAndOptimized.add(new Traversal[]{
                __.project("a", "b", "c", "d", "e")
                        .by(values("name"))
                        .by(__.id())
                        .by(__.label())
                        .by(__.identity())
                        .by(__.outE().count()),
                __.project("a", "b", "c", "d", "e")
                        .by("name")
                        .by(T.id)
                        .by(T.label)
                        .by()
                        .by(__.outE().count())
        });

        final GraphTraversal[] baseGroupTraversals = new GraphTraversal[]{
                __.group().by("age"),
                __.group("x").by("age"),
        };

        for (final Traversal traversal : baseGroupTraversals) {
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(values("name").fold()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by("name"),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.id().fold()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.id),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.label().fold()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.label),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.key().fold()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.key),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.value().fold()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(T.value),
            });
            originalAndOptimized.add(new Traversal[]{
                    ((GraphTraversal<?, ?>) traversal.asAdmin().clone()).by(__.identity()),
                    ((GraphTraversal) traversal.asAdmin().clone()).by(),
            });
        }

        originalAndOptimized.add(new Traversal[]{
                __.group().by(values("age")).by(values("name")),
                __.group().by("age").by(values("name"))
        });

        originalAndOptimized.add(new Traversal[]{
                __.group("x").by(values("age")).by(values("name")),
                __.group("x").by("age").by(values("name"))
        });

        originalAndOptimized.add(new Traversal[]{
                __.group().by(values("age")).by(values("name").fold()),
                __.group().by("age").by("name")
        });

        originalAndOptimized.add(new Traversal[]{
                __.group("x").by(values("age")).by(values("name").fold()),
                __.group("x").by("age").by("name")
        });

        return originalAndOptimized;
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/ByModulatorOptimizationStrategyTest.java