@Test
    public void shouldOnlyAllowAnonymousChildren() {
        final GraphTraversalSource g = traversal().with(EmptyGraph.instance());
        g.V(1).addE("self").to(__.V(1));
        try {
            g.V(1).addE("self").to(g.V(1));
            fail("Should not allow child traversals spawned from 'g'");
        } catch (IllegalStateException ignored) {}
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalTest.java