    @Test
    public void testCountByLane() {

        int[] count ={0};
        double[] speeds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

        TrafficDensity2 trafficDensity = new TrafficDensity2(){
            @Override
            protected double calcSpeed(Vehicle vehicle, double traction, double timeSec) {
                return speeds[count[0]++];
            }
        };
        double timeSec = 10.0;
        int trafficUnitsNumber = speeds.length;

        double[] speedLimitByLane = {4.5, 8.5, 12.5};
        Integer[] expectedCountByLane = {4, 4, 4};

        Integer[] trafficByLane = trafficDensity.trafficByLane(getTrafficUnitStream(trafficUnitsNumber), trafficUnitsNumber, timeSec, FactorySpeedModel.getSpeedModel(), speedLimitByLane );
        assertArrayEquals("Assert count of " + speeds.length + " vehicles by " + speedLimitByLane.length + " lanes with speed limit "
                        + Arrays.stream(speedLimitByLane).mapToObj(Double::toString).collect(Collectors.joining(", ")),
                expectedCountByLane, trafficByLane);
    }