DefaultEdgeTraversal extends AbstractEdgeTraversal implements EdgeTraversal { @Override public Stream<EdgeEntity> stream() { return flow.apply(supplier.get()).toList().stream().map(converter::toEdgeEntity); } DefaultEdgeTraversal(Supplier<GraphTraversal<?, ?>> supplier,
                         Function<GraphTraversal<?, ?>, GraphTraversal<Vertex, Edge>> flow,
                         GraphConverter converter); @Override EdgeTraversal has(String propertyKey); @Override EdgeTraversal has(String propertyKey, Object value); @Override EdgeTraversal has(String propertyKey, P<?> predicate); @Override EdgeTraversal has(T accessor, Object value); @Override EdgeTraversal has(T accessor, P<?> predicate); @Override EdgeTraversal hasNot(String propertyKey); @Override EdgeTraversal filter(Predicate<EdgeEntity> predicate); @Override EdgeTraversal limit(long limit); @Override EdgeTraversal range(long start, long end); @Override EdgeRepeatTraversal repeat(); @Override VertexTraversal inV(); @Override VertexTraversal outV(); @Override VertexTraversal bothV(); @Override Optional<EdgeEntity> next(); @Override Optional<EdgeEntity> getSingleResult(); @Override List<EdgeEntity> getResultList(); @Override Stream<EdgeEntity> stream(); @Override Stream<EdgeEntity> next(int limit); @Override ValueMapTraversal valueMap(String... propertyKeys); @Override EdgeTraversalOrder orderBy(String property); @Override long count();  }
@Test public void shouldReturnOutE() { List<EdgeEntity> edges = graphTemplate.getTraversalVertex().outE(READS) .<Person, Book>stream() .collect(toList()); assertEquals(3, edges.size()); assertThat(edges, containsInAnyOrder(reads, reads2, reads3)); }
@Test public void shouldReturnOutEWithSupplier() { List<EdgeEntity> edges = graphTemplate.getTraversalVertex().outE(() -> READS) .<Person, Book>stream() .collect(toList()); assertEquals(3, edges.size()); assertThat(edges, containsInAnyOrder(reads, reads2, reads3)); }
@Test public void shouldReturnErrorOutEWhenIsNull() { assertThrows(NullPointerException.class, () -> graphTemplate.getTraversalVertex().outE((String) null) .<Person, Book>stream() .collect(toList())); }
@Test public void shouldReturnInE() { List<EdgeEntity> edges = graphTemplate.getTraversalVertex().inE(READS) .<Person, Book>stream() .collect(toList()); assertEquals(3, edges.size()); assertThat(edges, containsInAnyOrder(reads, reads2, reads3)); }
@Test public void shouldReturnInEWitSupplier() { List<EdgeEntity> edges = graphTemplate.getTraversalVertex().inE(() -> READS) .<Person, Book>stream() .collect(toList()); assertEquals(3, edges.size()); assertThat(edges, containsInAnyOrder(reads, reads2, reads3)); }
@Test public void shouldReturnErrorWhenInEIsNull() { assertThrows(NullPointerException.class, () -> graphTemplate.getTraversalVertex().inE((String) null) .<Person, Book>stream() .collect(toList())); }
@Test public void shouldReturnBothE() { List<EdgeEntity> edges = graphTemplate.getTraversalVertex().bothE(READS) .<Person, Book>stream() .collect(toList()); assertEquals(6, edges.size()); }
@Test public void shouldReturnBothEWithSupplier() { List<EdgeEntity> edges = graphTemplate.getTraversalVertex().bothE(() -> READS) .<Person, Book>stream() .collect(toList()); assertEquals(6, edges.size()); }
@Test public void shouldReturErrorWhennBothEIsNull() { assertThrows(NullPointerException.class, () -> graphTemplate.getTraversalVertex().bothE((String) null) .<Person, Book>stream() .collect(toList())); }