@Test
    public void shouldReadWriteEdge() throws Exception {
        final String resourceName = "traversal-edge";

        final Edge resource = findModelEntryObject(resourceName);
        final byte[] bytes = write(resource, Edge.class, resourceName);
        final HashMap fromStatic = read(readFromResource(resourceName), HashMap.class);
        final HashMap recycled = read(bytes, HashMap.class);
        assertNotSame(fromStatic, recycled);
        assertEquals(resource.id(), fromStatic.get("id"));
        assertEquals(Collections.singletonList(resource.label()), fromStatic.get("label"));
        assertEquals(resource.id(), fromStatic.get("id"));
        assertEquals(Collections.singletonList(resource.inVertex().label()), ((Map) fromStatic.get("inV")).get("label"));
        assertEquals(Collections.singletonList(resource.outVertex().label()), ((Map) fromStatic.get("outV")).get("label"));
        assertEquals(resource.inVertex().id(), ((Map) fromStatic.get("inV")).get("id"));
        assertEquals(resource.outVertex().id(), ((Map) fromStatic.get("outV")).get("id"));
        assertEquals(resource.id(), recycled.get("id"));
        assertEquals(Collections.singletonList(resource.label()), recycled.get("label"));
        assertEquals(resource.id(), recycled.get("id"));
        assertEquals(Collections.singletonList(resource.inVertex().label()), ((Map) recycled.get("inV")).get("label"));
        assertEquals(Collections.singletonList(resource.outVertex().label()), ((Map) recycled.get("outV")).get("label"));
        assertEquals(resource.inVertex().id(), ((Map) recycled.get("inV")).get("id"));
        assertEquals(resource.outVertex().id(), ((Map) recycled.get("outV")).get("id"));

        // deal with incompatibilities
        if (getCompatibility().equals("v1-no-types") || getCompatibility().equals("v3-no-types")) {
            assertEquals("edge", fromStatic.get("type"));
            assertEquals(IteratorUtils.count(resource.properties()), ((Map) fromStatic.get("properties")).size());
            assertEquals(resource.value("since"), ((Map) fromStatic.get("properties")).get("since"));
            assertEquals("edge", recycled.get("type"));
            assertEquals(IteratorUtils.count(resource.properties()), ((Map) recycled.get("properties")).size());
            assertEquals(resource.value("since"), ((Map) recycled.get("properties")).get("since"));
        } else if (getCompatibility().equals("v2-no-types")) {
            assertEquals(IteratorUtils.count(resource.properties()), ((Map) fromStatic.get("properties")).size());
            assertEquals(resource.keys().iterator().next(), ((Map) ((Map) fromStatic.get("properties")).get("since")).get("key"));
            assertEquals(resource.value("since"), ((Map) ((Map) fromStatic.get("properties")).get("since")).get("value"));
            assertEquals(IteratorUtils.count(resource.properties()), ((Map) recycled.get("properties")).size());
            assertEquals(resource.keys().iterator().next(), ((Map) ((Map) recycled.get("properties")).get("since")).get("key"));
            assertEquals(resource.value("since"), ((Map) ((Map) recycled.get("properties")).get("since")).get("value"));
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractUntypedCompatibilityTest.java