graph.addConnection(NE, SE);
final MovingRoadUser agent1 = new TestRoadUser();
model.addObjectAt(agent1, SW);
model.followPath(agent1, new LinkedList<Point>(asList(SW, SE)), hour(5));
assertEquals(new Point(5, 0), model.getPosition(agent1));
final MovingRoadUser agent2 = new TestRoadUser();
model.addObjectAt(agent2, SW);
assertEquals(new Point(0, 0), model.getPosition(agent2));
final Queue<Point> path1 = new LinkedList<Point>(model.getShortestPathTo(
agent2, agent1));
assertEquals(asList(SW, new Point(5, 0)), path1);
model.followPath(agent2, path1, hour(10));
assertEquals(new Point(5, 0), model.getPosition(agent2));
final Queue<Point> path2 = new LinkedList<Point>(model.getShortestPathTo(
agent2, NE));
assertEquals(asList(new Point(5, 0), SE, NE), path2);
model.followPath(agent2, path2, hour(10));
assertEquals(new Point(10, 5), model.getPosition(agent2));
assertTrue(connectionEquals(model.getConnection(agent2), SE, NE));
// coming from the front side, we have to turn around at p1
final Queue<Point> path3 = new LinkedList<Point>(model.getShortestPathTo(
agent2, agent1));
assertEquals(asList(new Point(10, 5), NE, SE, SW, new Point(5, 0)), path3);
model.followPath(agent2, path3, hour(100));
assertEquals(new Point(5, 0), model.getPosition(agent1));
assertEquals(new Point(5, 0), model.getPosition(agent2));
graph.addConnection(SW, NW);
graph.addConnection(NW, SW);
model.followPath(agent2, new LinkedList<Point>(asList(SE, SW, NW)),
hour(25));
assertEquals(new Point(0, 10), model.getPosition(agent2));
// coming from the back side, no turning around is required
final Queue<Point> path4 = new LinkedList<Point>(model.getShortestPathTo(
agent2, agent1));
assertEquals(asList(NW, SW, new Point(5, 0)), path4);
assertEquals(10,
model.followPath(agent2, path4, hour(10)).distance.getValue(), EPSILON);
assertEquals(new Point(0, 0), model.getPosition(agent2));
assertEquals(5,
model.followPath(agent2, path4, hour(20)).distance.getValue(), EPSILON);
assertEquals(new Point(5, 0), model.getPosition(agent2));
}