InternalPath implements Path, AsValue { @Override public Iterable<Relationship> relationships() { return relationships; } InternalPath( List<Entity> alternatingNodeAndRel );  InternalPath( Entity... alternatingNodeAndRel );  InternalPath( List<Segment> segments, List<Node> nodes, List<Relationship> relationships ); @Override int length(); @Override boolean contains( Node node ); @Override boolean contains( Relationship relationship ); @Override Iterable<Node> nodes(); @Override Iterable<Relationship> relationships(); @Override Node start(); @Override Node end(); @Override Iterator<Segment> iterator(); @Override Value asValue(); @Override boolean equals( Object o ); @Override int hashCode(); @Override String toString();  }
@Test void shouldBeAbleToIterateOverPathRelationships() { InternalPath path = testPath(); List<Relationship> segments = Iterables.asList( path.relationships() ); assertThat( segments, equalTo( Arrays.asList( (Relationship) new InternalRelationship( -1, 1, 2, "KNOWS" ), new InternalRelationship( -2, 3, 2, "KNOWS" ), new InternalRelationship( -3, 3, 4, "KNOWS" ) ) ) ); }