FramedVertex extends FramedElement { protected void unlinkBoth(FramedVertex vertex, String... labels) { if (vertex != null) { bothE(labels).mark().bothV().retain(vertex).back().removeAll(); } else { bothE(labels).removeAll(); } }  JsonObject toJson(); @Override String toString();  }
@Test public void testUnlinkBoth(){ String label = "knows"; Person p3 = fg.addVertex(Person.class); Person p4 = fg.addVertex(Person.class); Person p5 = fg.addVertex(Person.class); p4.addEdge(label, p3, Knows.class); p5.addEdge(label, p3, Knows.class); p3.addEdge(label, p4, Knows.class); p3.addEdge(label, p5, Knows.class); long allInEdgesCount = p3.both(label).count(); Long targetVertex_EdgeCount = p3.both(label).mark().retain(Lists.newArrayList(p4)).back().count(); Assert.assertTrue("target vertex requires an in/out edge for "+label, targetVertex_EdgeCount > 0); Assert.assertTrue("Multiple edges of type "+label+" must exist for vertice", allInEdgesCount - targetVertex_EdgeCount > 0); p3.unlinkBoth(p4, label); Assert.assertEquals("All " + label + " edges(in/out) should have been removed from given vertex", 0, p3.both(label).retain(Lists.newArrayList(p4)).count()); Assert.assertTrue("All " + label + " edges(in/out) should have remained for other vertices", p3.bothE(label).count() > 0); }