@Test
        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
        @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = FEATURE_STRING_VALUES)
        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
        public void shouldReadWriteSelfLoopingEdges() throws Exception {
            final Graph source = graph;
            final Vertex v1 = source.addVertex();
            final Vertex v2 = source.addVertex();
            v1.addEdge("CONTROL", v2);
            v1.addEdge("SELFLOOP", v1);

            final Configuration targetConf = graphProvider.newGraphConfiguration("target", this.getClass(), name.getMethodName(), null);
            final Graph target = graphProvider.openTestGraph(targetConf);
            try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
                source.io(IoCore.graphml()).writer().create().writeGraph(os, source);
                try (ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray())) {
                    target.io(IoCore.graphml()).reader().create().readGraph(is, target);
                }
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            }

            assertEquals(IteratorUtils.count(source.vertices()), IteratorUtils.count(target.vertices()));
            assertEquals(IteratorUtils.count(source.edges()), IteratorUtils.count(target.edges()));
        }
Note: this is only a very lightweight test of writer/reader encoding. It is known that there are characters
which, when written by GraphMLWriter, cause parse errors for GraphMLReader. However, this happens uncommonly
enough that is not yet known which characters those are. Only need to execute this test with TinkerGraph
or other graphs that support user supplied identifiers.
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java