@Parameterized.Parameters(name = "{0}")
    public static Iterable<Pair<String, ParserRule>> parseTestItems() throws IOException {
        // gremlin scripts from docs
        final Set<Pair<String, ParserRule>> scripts = DocumentationReader.parse(docsDir).
                stream().map(g -> Pair.with(g, ParserRule.QUERY_LIST)).
                collect(Collectors.toCollection(LinkedHashSet::new));

        // helps make sure we're actually adding test scripts for each load. there are well over 500 gremlin
        // examples in the docs so we should have at least that much
        int size = scripts.size();
        assert size > 500;

        // gremlin scripts from feature tests
        scripts.addAll(FeatureReader.parseGrouped(featureDir, stringMatcherConverters).values().stream().
                flatMap(Collection::stream).
                map(g -> Pair.with(g, ParserRule.QUERY_LIST)).
                collect(Collectors.toList()));

        // there are well over 1000 tests so make sure we parsed something sensible
        assert size + 1000 < scripts.size();
        size = scripts.size();

        // validate that every keyword is parseable as a map key
        scripts.addAll(GrammarReader.parse(grammarFile).stream().
                flatMap(g -> Stream.of(
                        Pair.with(String.format("g.inject([%s:123])", g), ParserRule.QUERY_LIST)
                )).collect(Collectors.toList()));

        // there have to be at least 200 tokens parsed from the grammar. just picked a big number to help validate
        // that the GrammarReader is doing smart things.
        assert size + 200 < scripts.size();
        size = scripts.size();

        // tests for validating gremlin values like Map, String, etc.
        final InputStream stream = ReferenceGrammarTest.class.getClassLoader()
                .getResourceAsStream("gremlin-values.txt");
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
            String line;
            while ((line = reader.readLine()) != null) {
                if (!line.startsWith("#") && !line.isEmpty()) {
                    scripts.add(Pair.with(String.format("g.inject(%s)", line), ParserRule.QUERY_LIST));
                }
            }
        }

        // at least 300 lines in gremlin-values.txt
        assert size + 300 < scripts.size();

        return scripts;
    }
Builds a corpus of Gremlin statements from Recipes, "The Traversal" in Reference Documentation and the Gherkin
test suite and passes them all through the grammar parser.
gremlin-language/src/test/java/org/apache/tinkerpop/gremlin/language/grammar/ReferenceGrammarTest.java