@Test
    public void shouldContainReuseableGremlinLang() {
        final Pattern paramPatter = Pattern.compile("xx\\d+");
        assertThat(g.getGremlinLang().getOptionsStrategies().isEmpty(), is(true));
        g.with("a", "1").V();
        assertThat(g.getGremlinLang().getOptionsStrategies().isEmpty(), is(true));
        g.with("b", "2").V();
        assertThat(g.getGremlinLang().getOptionsStrategies().isEmpty(), is(true));

        assertThat(g.getGremlinLang().getParameters().isEmpty(), is(true));
        GremlinLang lang = g.V(GValue.of("xx1", 11)).asAdmin().getGremlinLang();
        assertThat(g.getGremlinLang().getParameters().isEmpty(), is(true));
        assertThat(lang.getParameters().size(), is(1));
        assertThat(lang.getParameters().values(), containsInAnyOrder(11));
        Matcher paramMatcher = paramPatter.matcher(lang.getGremlin());
        paramMatcher.find();
        assertThat(lang.getParameters().keySet(), containsInAnyOrder(paramMatcher.group()));

        lang = g.V(GValue.of("xx2", 22)).asAdmin().getGremlinLang();
        assertThat(g.getGremlinLang().getParameters().isEmpty(), is(true));
        assertThat(lang.getParameters().size(), is(1));
        assertThat(lang.getParameters().values(), containsInAnyOrder(22));
        paramMatcher = paramPatter.matcher(lang.getGremlin());
        paramMatcher.find();
        assertThat(lang.getParameters().keySet(), containsInAnyOrder(paramMatcher.group()));
    }
This test demonstrates how one method for using Mockito to mock {@code g} to help with unit testing
applications where the logic of the query itself does not need to be validated, but rather surrounding
logic of the application. It is really important to note that all internal processing of the query is
ignored under this model and no TinkerPop code is executed so even invalid queries that are incorrect
will return the static data encoded to the mock.
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java