### Question:
TrafficDensity3 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); }  Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
                                   SpeedModel speedModel, double[] speedLimitByLane);  }### Answer:
@Test public void testCalcSpeed(){ double timeSec = 10.0; TrafficDensity3 trafficDensity = new TrafficDensity3(); Vehicle vehicle = Mockito.mock(Vehicle.class); Mockito.when(vehicle.getSpeedMph(timeSec)).thenReturn(100d); double traction = 0.2; double speed = trafficDensity.calcSpeed(vehicle, traction, timeSec); assertEquals("Assert speed (traction=" + traction + ") in " + timeSec + " sec: ", 20, speed, 0.001 * speed); }