RoadPath extends GraphPath<RoadPath, RoadSegment, RoadConnection> { @Pure public RoadConnection getFirstCrossRoad() { for (final RoadConnection pt : points()) { if (pt.getConnectedSegmentCount() > 2) { return pt; } } return null; } protected  RoadPath(List<RoadSegment> original);  RoadPath();  RoadPath(RoadSegment segment);  RoadPath(RoadSegment segment, RoadConnection starting_point);  RoadPath(RoadPath path); static boolean addPathToPath(RoadPath inside, RoadPath elements); static RoadPath of(List<RoadSegment> original); @Override @Pure Object[] toArray(); @Pure Direction1D getSegmentDirectionAt(int index); @Pure boolean isConnectableTo(RoadPath path); @Pure RoadSegment getConnectableSegmentToFirstPoint(RoadPath path); @Pure RoadSegment getConnectableSegmentToLastPoint(RoadPath path); @Pure boolean isFirstPointConnectableTo(RoadPath path); @Pure boolean isLastPointConnectableTo(RoadPath path); @Pure boolean isCulDeSacWay(); @Pure RoadConnection getFirstCrossRoad(); @Pure CrossRoad getFirstJunctionPoint(); @Pure Iterator<CrossRoad> crossRoads();  }
@Test public void testGetFirstCrossRoad() { RoadPath path = new RoadPath(); path.add(this.segment3, this.segment3.getBeginPoint()); path.add(this.segment4); path.add(this.segment1); path.add(this.segment2); path.add(this.segment6, this.segment6.getEndPoint()); path.add(this.segment8); assertFalse(path.isEmpty()); assertEquals(6, path.size()); assertEquals(this.segment2.getBeginPoint(), path.getFirstCrossRoad()); }