@Test
    @LoadGraphWith(MODERN)
    public void shouldDumpWholeGraph() throws Exception {
        if (graphProvider.getGraphComputer(graph).features().supportsResultGraphPersistCombination(GraphComputer.ResultGraph.NEW, GraphComputer.Persist.EDGES)) {
            final ComputerResult result = graphProvider.getGraphComputer(graph).program(CloneVertexProgram.build().create(graph)).submit().get();
            result.graph().traversal().V().forEachRemaining(v -> {
                assertEquals(2, v.keys().size());
                assertTrue(v.keys().contains("name"));
                assertTrue(v.keys().contains("age") || v.keys().contains("lang"));
                assertEquals(1, IteratorUtils.count(v.values("name")));
                assertEquals(1, IteratorUtils.count(v.values("age", "lang")));
                final String name = v.value("name");
                if (name.equals("marko")) {
                    assertEquals("person", v.label());
                    assertEquals(Integer.valueOf(29), v.value("age"));
                    assertEquals(3, IteratorUtils.count(v.edges(Direction.OUT)));
                    assertEquals(2, IteratorUtils.count(v.edges(Direction.OUT, "knows")));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT, "created")));
                    assertEquals(0, IteratorUtils.count(v.edges(Direction.IN)));
                } else if (name.equals("vadas")) {
                    assertEquals("person", v.label());
                    assertEquals(Integer.valueOf(27), v.value("age"));
                    assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows")));
                } else if (name.equals("lop")) {
                    assertEquals("software", v.label());
                    assertEquals("java", v.value("lang"));
                    assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
                    assertEquals(3, IteratorUtils.count(v.edges(Direction.IN)));
                    assertEquals(3, IteratorUtils.count(v.edges(Direction.IN, "created")));
                } else if (name.equals("josh")) {
                    assertEquals("person", v.label());
                    assertEquals(Integer.valueOf(32), v.value("age"));
                    assertEquals(2, IteratorUtils.count(v.edges(Direction.OUT)));
                    assertEquals(2, IteratorUtils.count(v.edges(Direction.OUT, "created")));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows")));
                } else if (name.equals("ripple")) {
                    assertEquals("software", v.label());
                    assertEquals("java", v.value("lang"));
                    assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "created")));
                } else if (name.equals("peter")) {
                    assertEquals("person", v.label());
                    assertEquals(Integer.valueOf(35), v.value("age"));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT)));
                    assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT, "created")));
                    assertEquals(0, IteratorUtils.count(v.edges(Direction.IN)));
                } else
                    throw new IllegalStateException("The following vertex should not exist in the graph: " + name);
            });
            assertEquals(3.5, (Double) result.graph().traversal().E().values("weight").sum().next(), 0.01);
            assertEquals(1.5, (Double) result.graph().traversal().E().hasLabel("knows").values("weight").sum().next(), 0.01);
            assertEquals(2.0, (Double) result.graph().traversal().E().hasLabel("created").values("weight").sum().next(), 0.01);
            assertEquals(result.memory().getIteration(), 0);
            assertEquals(result.memory().asMap().size(), 0);
        }
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clone/CloneVertexProgramTest.java