assertEquals(r0.id(), r1.sourceRoadSegment(Lanes.LANE1).id());
assertEquals(r0.id(), r1.sourceRoadSegment(Lanes.LANE2).id());
assertEquals(null, r1.sourceRoadSegment(Lanes.LANE3));
// vehicles suffixed 0 are on r0, vehicles suffixed 1 are on r1
final Vehicle z1 = newVehicle(5.0, 1.0, Lanes.LANE1);
r1.addVehicle(z1);
final Vehicle z0 = newVehicle(996.0, 3.0, Lanes.LANE1);
r0.addVehicle(z0);
final Vehicle y1 = newVehicle(3.0, 4.0, Lanes.LANE2);
r1.addVehicle(y1);
final Vehicle y0 = newVehicle(998.0, 5.0, Lanes.LANE2);
r0.addVehicle(y0);
// vehicle in exit lane
final Vehicle x1 = newVehicle(5.0, 5.0, Lanes.LANE3);
r1.addVehicle(x1);
Vehicle rV = r1.rearVehicle(Lanes.LANE1, 6.0);
assertEquals(z1, rV);
rV = r1.rearVehicle(Lanes.LANE1, 5.0);
assertEquals(z1, rV);
rV = r1.rearVehicle(Lanes.LANE1, 4.0);
assertEquals(z0.getId(), rV.getId());
assertEquals(-4.0, rV.getRearPosition(), delta);
assertEquals(3.0, rV.getSpeed(), delta);
rV = r1.rearVehicle(Lanes.LANE1, 3.0);
assertEquals(z0.getId(), rV.getId());
rV = r1.rearVehicle(Lanes.LANE2, 4.0);
assertEquals(y1, rV);
rV = r1.rearVehicle(Lanes.LANE2, 3.0);
assertEquals(y1, rV);
rV = r1.rearVehicle(Lanes.LANE2, 2.0);
assert rV != null;
assertEquals(y0.getId(), rV.getId());
assertEquals(-2.0, rV.getRearPosition(), delta);
assertEquals(5.0, rV.getSpeed(), delta);
rV = r1.rearVehicle(Lanes.LANE2, 1.0);
assertEquals(y0.getId(), rV.getId());
}