@Test
    public void shouldProvideClearErrorWhenFromOrToDoesNotResolveToVertex() {
        final GraphTraversalSource g = TinkerFactory.createModern().traversal();

        try {
            g.addE("link").property(VertexProperty.Cardinality.single, "k", 100).to(__.V(1)).iterate();
            fail("Should have thrown an error");
        } catch (IllegalStateException ise) {
            assertEquals("The value given to addE(link).from() must resolve to a Vertex but null was specified instead", ise.getMessage());
        }

        try {
            g.addE("link").property(VertexProperty.Cardinality.single, "k", 100).from(__.V(1)).iterate();
            fail("Should have thrown an error");
        } catch (IllegalStateException ise) {
            assertEquals("The value given to addE(link).to() must resolve to a Vertex but null was specified instead", ise.getMessage());
        }

        try {
            g.addE("link").property("k", 100).from(__.V(1)).iterate();
            fail("Should have thrown an error");
        } catch (IllegalStateException ise) {
            assertEquals("The value given to addE(link).to() must resolve to a Vertex but null was specified instead", ise.getMessage());
        }

        try {
            g.V(1).values("name").as("a").addE("link").property(VertexProperty.Cardinality.single, "k", 100).from("a").iterate();
            fail("Should have thrown an error");
        } catch (IllegalStateException ise) {
            assertEquals("The value given to addE(link).to() must resolve to a Vertex but String was specified instead", ise.getMessage());
        }

        try {
            g.V(1).values("name").as("a").addE("link").property(VertexProperty.Cardinality.single, "k", 100).to("a").iterate();
            fail("Should have thrown an error");
        } catch (IllegalStateException ise) {
            assertEquals("The value given to addE(link).to() must resolve to a Vertex but String was specified instead", ise.getMessage());
        }

        try {
            g.V(1).as("v").values("name").as("a").addE("link").property(VertexProperty.Cardinality.single, "k", 100).to("v").from("a").iterate();
            fail("Should have thrown an error");
        } catch (IllegalStateException ise) {
            assertEquals("The value given to addE(link).to() must resolve to a Vertex but String was specified instead", ise.getMessage());
        }
    }
Validating that mid-traversal hasId() also unwraps ids in lists in addition to ids in arrays as per TINKERPOP-2863
tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java