@Test
    public void shouldHandleVertex() throws Exception {
        final Vertex v = new DetachedVertex(123L, "person", Arrays.asList(
                DetachedVertexProperty.build().setId(1).setLabel("name").setValue("alice").create(),
                DetachedVertexProperty.build().setId(1).setLabel("age").setValue("31").create()));
        final String json = mapper.writeValueAsString(v);

        // v2 untyped seems to serialize the VertexProperty label. not changing that since it's already been
        // introduced a long while back. v3 dips back to v1 style - since it has never existed prior to 3.7.0
        // we can make this change
        if (version.startsWith("v1") || version.startsWith("v3"))
            assertEquals("{\"id\":123,\"label\":\"person\",\"type\":\"vertex\",\"properties\":{\"name\":[{\"id\":1,\"value\":\"alice\"}],\"age\":[{\"id\":1,\"value\":\"31\"}]}}", json);
        else if (version.startsWith("v2"))
            assertEquals("{\"id\":123,\"label\":\"person\",\"properties\":{\"name\":[{\"id\":1,\"value\":\"alice\",\"label\":\"name\"}],\"age\":[{\"id\":1,\"value\":\"31\",\"label\":\"age\"}]}}", json);
        else if (version.startsWith("v4"))
            assertEquals("{\"id\":123,\"label\":[\"person\"],\"type\":\"vertex\",\"properties\":{\"name\":[{\"id\":1,\"value\":\"alice\"}],\"age\":[{\"id\":1,\"value\":\"31\"}]}}", json);
        else
            throw new IllegalStateException("Version not accounted for in asserts");
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java