@Test
    public void shouldDetachPathToReferenceWithEmbeddedLists() {
        final Path path = MutablePath.make();
        path.extend(DetachedVertex.build().setId(1).setLabel("person").
                addProperty(new DetachedVertexProperty<>(
                        101, "name", "stephen", Collections.emptyMap())).create(), Collections.singleton("a"));
        path.extend(Collections.singletonList(DetachedVertex.build().setId(2).setLabel("person").
                addProperty(new DetachedVertexProperty<>(
                        102, "name", "vadas", Collections.emptyMap())).create()), Collections.singleton("a"));
        path.extend(Collections.singletonList(Collections.singletonList(DetachedVertex.build().setId(3).setLabel("person").
                addProperty(new DetachedVertexProperty<>(
                        103, "name", "josh", Collections.emptyMap())).create())), Collections.singleton("a"));

        final Path detached = ReferenceFactory.detach(path);
        final Vertex v1  = detached.get(0);
        assertThat(v1, instanceOf(ReferenceVertex.class));
        assertThat(v1.properties().hasNext(), is(false));

        final Vertex v2  = (Vertex) ((List) detached.get(1)).get(0);
        assertThat(v2, instanceOf(ReferenceVertex.class));
        assertThat(v2.properties().hasNext(), is(false));

        final Vertex v3  = (Vertex) ((List) ((List) detached.get(2)).get(0)).get(0);
        assertThat(v3, instanceOf(ReferenceVertex.class));
        assertThat(v3.properties().hasNext(), is(false));
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceFactoryTest.java