### Question:
TrafficDensity3 { protected int calcLaneNumber(int lanesCount, double[] speedLimitByLane, double speed){ for(int i = 1; i <= lanesCount; i++){ if(speed <= speedLimitByLane[i - 1]){ return i; } } return lanesCount; }  Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
                                   SpeedModel speedModel, double[] speedLimitByLane);  }### Answer:
@Test public void testCalcLaneNumber() { double[] speeds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; double[] speedLimitByLane = {4.5, 8.5, 12.5}; int[] expectedLaneNumber = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3}; TrafficDensityTestCalcLaneNumber trafficDensity = new TrafficDensityTestCalcLaneNumber(); for(int i = 0; i < speeds.length; i++){ int ln = trafficDensity.calcLaneNumber(speedLimitByLane.length, speedLimitByLane, speeds[i]); assertEquals("Assert lane number of speed " + speeds + " with speed limit " + Arrays.stream(speedLimitByLane).mapToObj(Double::toString).collect(Collectors.joining(", ")), expectedLaneNumber[i], ln); } }