@Test
    public void shouldHandleEdge() throws Exception {
        final Edge e = new DetachedEdge(123L, "knows", new HashMap<String,Object>() {{
            put("weight", 0.5d);
        }}, 1L, "person", 2L, "person");
        final String json = mapper.writeValueAsString(e);

        // 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\":\"knows\",\"type\":\"edge\",\"inVLabel\":\"person\",\"outVLabel\":\"person\",\"inV\":2,\"outV\":1,\"properties\":{\"weight\":0.5}}", json);
        else if (version.startsWith("v2"))
            assertEquals("{\"id\":123,\"label\":\"knows\",\"inVLabel\":\"person\",\"outVLabel\":\"person\",\"inV\":2,\"outV\":1,\"properties\":{\"weight\":{\"key\":\"weight\",\"value\":0.5}}}", json);
        else if (version.startsWith("v4"))
            assertEquals("{\"id\":123,\"label\":[\"knows\"],\"type\":\"edge\",\"inV\":{\"id\":2,\"label\":[\"person\"]},\"outV\":{\"id\":1,\"label\":[\"person\"]},\"properties\":{\"weight\":[0.5]}}", 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