final int laneCount = 1;
final RoadSegment r0 = new RoadSegment(3900.0, laneCount);
// join r0 and r1 so vehicles move from r0 to r1
Link.addJoin(r0, r0);
final Vehicle v0 = newVehicle(3895.0, 80.0, Lanes.LANE1);
r0.addVehicle(v0);
final Vehicle v1 = newVehicle(3700.0, 20.0, Lanes.LANE1);
r0.addVehicle(v1);
final Vehicle v2 = newVehicle(3100.0, 30.0, Lanes.LANE1);
r0.addVehicle(v2);
final Vehicle v3 = newVehicle(695.0, 40.0, Lanes.LANE1);
r0.addVehicle(v3);
final Vehicle v4 = newVehicle(500.0, 50.0, Lanes.LANE1);
r0.addVehicle(v4);
final double dt = 0.25;
final double simulationTime = 0.0;
final long iterationCount = 0;
r0.updateVehiclePositionsAndSpeeds(dt, simulationTime, iterationCount);
assertEquals(true, r0.eachLaneIsSorted());
r0.outFlow(dt, simulationTime, iterationCount);
assertEquals(15.0, v0.getRearPosition(), delta);
assertEquals(3705.0, v1.getRearPosition(), delta);
assertEquals(3107.5, v2.getRearPosition(), delta);
assertEquals(705.0, v3.getRearPosition(), delta);
assertEquals(512.5, v4.getRearPosition(), delta);
assertEquals(true, r0.eachLaneIsSorted());
}