PlaneRoadModel extends AbstractRoadModel { @Override public List<Point> getShortestPathTo(Point from, Point to) { checkArgument( isPointInBoundary(from), "from must be within the predefined boundary of the plane, from is %s, " + "boundary: min %s, max %s.", from, min, max); checkArgument( isPointInBoundary(to), "to must be within the predefined boundary of the plane, to is %s," + " boundary: min %s, max %s.", to, min, max); return asList(from, to); } PlaneRoadModel(RoadModelBuilders.AbstractPlaneRMB<?, ?> b); @Override Point getRandomPosition(RandomGenerator rnd); @Override void addObjectAt(RoadUser obj, Point pos); @Override List<Point> getShortestPathTo(Point from, Point to); @Override RoadPath getPathTo(Point from, Point to, Unit<Duration> timeUnit,
      Measure<Double, Velocity> speed, GeomHeuristic heuristic); @Override RoadPath getPathTo(MovingRoadUser object, Point destination,
      Unit<Duration> timeUnit, Measure<Double, Velocity> speed,
      GeomHeuristic heuristic); @Override Measure<Double, Length> getDistanceOfPath(Iterable<Point> path); @Override ImmutableList<Point> getBounds(); @Override @Nonnull U get(Class<U> type); @Override RoadModelSnapshot getSnapshot(); final Point min; final Point max; final double width; final double height; final double maxSpeed; }
@Test(expected = IllegalArgumentException.class) public void getShortestPathToFail1() { model.getShortestPathTo(new Point(-1, 0), new Point(5, 5)); }
@Test(expected = IllegalArgumentException.class) public void getShortestPathToFail2() { model.getShortestPathTo(new Point(0, 0), new Point(-5, 5)); }
@Test public void getShortestPathTo() { assertEquals(asList(new Point(0, 0), new Point(5, 5)), model .getShortestPathTo(new Point(0, 0), new Point(5, 5))); }