@Then("the result should be a subgraph with the following")
    public void theResultShouldBeASubgraphWithEdges(final DataTable dataTable) {
        assertThatNoErrorWasThrown();

        // result should be a graph
        assertThat(result, instanceOf(Graph.class));

        // pop a graph traversal source from what was returned so we can use it for assertions
        final GraphTraversalSource sg = ((Graph) result).traversal();

        // the first item in the datatable tells us what we are asserting
        final boolean assertingVertices = dataTable.asList().get(0).equals("vertices") ? true : false;

        if (assertingVertices) {
            // grab the expected vertex in the subgraph
            final List<Vertex> expectedVertices = dataTable.asList().stream().skip(1).
                    map(this::convertToObject).
                    map(v -> (Vertex) v).collect(Collectors.toList());

            // expected vertices match the count in the graph
            assertEquals(expectedVertices.size(), sg.V().count().next().intValue());

            // assert the structure of the subgraph. there should be no references here as this is serialized as
            // a full TinkerGraph. also, ids should be the same as they are in the source graph so we can use all
            // of this to do a complete assertion. there is only support for the modern graph right now but it
            // wouldn't be hard to add others.
            for (Vertex vertex : expectedVertices) {
                final String variableKey = vertex.label().equals("person") ? "age" : "lang";

                assertThat(sg.V(vertex.id()).has(vertex.label(), "name", eq(vertex.value("name"))).
                                has(variableKey, eq(vertex.value(variableKey))).hasNext(),
                        equalTo(true));
            }
        } else {
            // grab the expected edges in the subgraph
            final List<Edge> expectedEdges = dataTable.asList().stream().skip(1).
                    map(this::convertToObject).
                    map(e -> (Edge) e).collect(Collectors.toList());

            // expected edges match the count in the graph
            assertEquals(expectedEdges.size(), sg.E().count().next().intValue());

            // assert the structure of the subgraph. there should be no references here as this is serialized as
            // a full TinkerGraph. also, ids should be the same as they are in the source graph so we can use all
            // of this to do a complete assertion. there is only support for the modern graph right now but it
            // wouldn't be hard to add others.
            for (Edge edge : expectedEdges) {
                assertThat(sg.E(edge.id()).
                                has(edge.label(), "weight", eq(edge.value("weight"))).
                                filter(__.outV().hasId(edge.outVertex().id())).
                                filter(__.inV().hasId(edge.inVertex().id())).hasNext(),
                        equalTo(true));
            }
        }
    }
Some implementations of {@link VertexProperty} are not {@code Serializable} and may lead to test failures when passed as
parameters. One such instance is {@code HadoopVertexProperty}. This method detaches vertex properties as tests
should never require implementation-specific elements.
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/StepDefinition.java