### Question:
VelocityController { public void advanceTime(int dt) { if (dt < 1) { throw new IllegalArgumentException("dt is less than 1"); } final int oldPosition = currentPosition; final int oldVelocity = currentVelocity; final Iterator<WayEntry> wayEntryIter = wayEntries.iterator(); final WayEntry curWayEntry = wayEntryIter.hasNext() ? wayEntryIter.next() : null; final int targetVelocity; final long accelerationDistance; if (curWayEntry == null || paused) { targetVelocity = 0; accelerationDistance = 1; currentAcceleration = 0; currentVelocity = 0; } else { final int maxVelocity; final Vehicle.Orientation orientation = curWayEntry.vehicleOrientation; switch (orientation) { case FORWARD: maxVelocity = maxFwdVelocity; break; case BACKWARD: maxVelocity = maxRevVelocity; break; default: LOG.warn("Unhandled orientation: {}, assuming forward.", orientation); maxVelocity = maxFwdVelocity; } targetVelocity = Math.min(curWayEntry.targetVelocity, maxVelocity); accelerationDistance = 10; currentAcceleration = (currentVelocity == targetVelocity) ? 0 : suitableAcceleration(targetVelocity, accelerationDistance); currentVelocity = oldVelocity + currentAcceleration * dt / 1000; currentPosition = oldPosition + oldVelocity * dt / 1000 + currentAcceleration * dt * dt / 1000000 / 2; if (currentPosition >= curWayEntry.length) { currentPosition -= curWayEntry.length; wayEntries.poll(); } } currentTime += dt; for (VelocityListener curListener : velocityListeners) { curListener.addVelocityValue(currentVelocity); } } VelocityController(int maxDecel,
                            int maxAccel,
                            int maxRevVelo,
                            int maxFwdVelo); int getMaxDeceleration(); void setMaxDeceleration(int maxDeceleration); int getMaxAcceleration(); void setMaxAcceleration(int maxAcceleration); int getMaxRevVelocity(); void setMaxRevVelocity(int maxRevVelocity); int getMaxFwdVelocity(); void setMaxFwdVelocity(int maxFwdVelocity); boolean isVehiclePaused(); void setVehiclePaused(boolean pause); void addVelocityListener(VelocityListener listener); void removeVelocityListener(VelocityListener listener); int getCurrentVelocity(); int getCurrentPosition(); long getCurrentTime(); void addWayEntry(WayEntry newEntry); WayEntry getCurrentWayEntry(); boolean hasWayEntries(); void advanceTime(int dt);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testNegativeAdvanceTimeShouldThrowException() { VelocityController controller = new VelocityController(MAX_DECEL, MAX_ACCEL, MAX_REV_VELO, MAX_FWD_VELO); controller.advanceTime(-1); }