@Test public void testFindElement() { Location location = (Location) createElement(); elementGraph.find(location); InOrder inOrder = inOrder(traversal); inOrder.verify(traversal, times(1)).hasLabel(location.label()); inOrder.verify(traversal, times(1)).has("name", location.name()); inOrder.verify(traversal, times(1)).has("startTime", location.startTime()); }
protected <E extends Element> GraphTraversal find(E element) { GraphTraversal traversal = g.V(); if (element.id() != null) { traversal = traversal.hasId(element.id()); } else { traversal = traversal.hasLabel(element.label()); Object[] properties = Properties.id(element); if (properties == null || properties.length == 0) { properties = Properties.all(element); } for (Property property : list(properties)) { traversal = traversal.has(property.key(), property.value()); } } return traversal; }
ElementGraph { protected <E extends Element> GraphTraversal find(E element) { GraphTraversal traversal = g.V(); if (element.id() != null) { traversal = traversal.hasId(element.id()); } else { traversal = traversal.hasLabel(element.label()); Object[] properties = Properties.id(element); if (properties == null || properties.length == 0) { properties = Properties.all(element); } for (Property property : list(properties)) { traversal = traversal.has(property.key(), property.value()); } } return traversal; } }
ElementGraph { protected <E extends Element> GraphTraversal find(E element) { GraphTraversal traversal = g.V(); if (element.id() != null) { traversal = traversal.hasId(element.id()); } else { traversal = traversal.hasLabel(element.label()); Object[] properties = Properties.id(element); if (properties == null || properties.length == 0) { properties = Properties.all(element); } for (Property property : list(properties)) { traversal = traversal.has(property.key(), property.value()); } } return traversal; }  }
ElementGraph { protected <E extends Element> GraphTraversal find(E element) { GraphTraversal traversal = g.V(); if (element.id() != null) { traversal = traversal.hasId(element.id()); } else { traversal = traversal.hasLabel(element.label()); Object[] properties = Properties.id(element); if (properties == null || properties.length == 0) { properties = Properties.all(element); } for (Property property : list(properties)) { traversal = traversal.has(property.key(), property.value()); } } return traversal; }   }
ElementGraph { protected <E extends Element> GraphTraversal find(E element) { GraphTraversal traversal = g.V(); if (element.id() != null) { traversal = traversal.hasId(element.id()); } else { traversal = traversal.hasLabel(element.label()); Object[] properties = Properties.id(element); if (properties == null || properties.length == 0) { properties = Properties.all(element); } for (Property property : list(properties)) { traversal = traversal.has(property.key(), property.value()); } } return traversal; }    }