@Test public void testCalcSpeed(){ double timeSec = 10.0; TrafficDensity2 trafficDensity = new TrafficDensity2(); 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); }
protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); }
TrafficDensity2 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } }
TrafficDensity2 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); }  }
TrafficDensity2 { 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); }
TrafficDensity2 { 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);  }