@Test
    @LoadGraphWith(MODERN)
    public void g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX3XX_hasXname_peterX_path_byXnameX() {
        final Traversal<Vertex, Path> traversal = get_g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX3XX_hasXname_peterX_path_byXnameX(convertToVertexId("marko"));
        printTraversalForm(traversal);
        int paths = 0;
        boolean has3 = false, has4 = false;
        while (traversal.hasNext()) {
            final Path path = traversal.next();
            switch (path.size()) {
                case 3:
                    assertEquals("marko", path.get(0));
                    assertEquals("lop", path.get(1));
                    assertEquals("peter", path.get(2));
                    has3 = true;
                    break;
                case 4:
                    assertEquals("marko", path.get(0));
                    assertEquals("josh", path.get(1));
                    assertEquals("lop", path.get(2));
                    assertEquals("peter", path.get(3));
                    has4 = true;
                    break;
            }
            paths++;
        }
        assertTrue(has3 && has4);
        assertEquals(2, paths);
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LoopsTest.java