### Question:
MoveToDistance implements ICommand { @Override public boolean update(double pNow) { boolean isFinished = false; double deltaDistance = distanceProvider.getAbsoluteDistanceInInches() - goalDistanceInInches; if(Util.epsilonEquals(deltaDistance, 0.0, mEpsilonInches)) { isFinished = true; } else if(deltaDistance > 0.0d) { drive.setDriveMessage(DriveMessage.fromThrottleAndTurn(mPower, 0)); isFinished = false; } else if(deltaDistance < 0.0d) { drive.setDriveMessage(DriveMessage.fromThrottleAndTurn(-mPower, 0)); } else { isFinished = true; } return isFinished; } MoveToDistance(Drive drive, IAbsoluteDistanceProvider distanceProvider, double goalDistanceInInches); @Override void init(double pNow); @Override void shutdown(double pNow); @Override boolean update(double pNow); MoveToDistance setEpsilonInches(double pEpsilonInches); MoveToDistance setPower(double pPower);  }### Answer:
@Test public void testSensorReadingGreater() { when(absoluteDistanceProvider.getAbsoluteDistanceInInches()).thenReturn(DESIRED_DISTANCE_IN_INCHES * 2); boolean isDone = distanceToCommand.update(System.currentTimeMillis()); assertFalse(isDone); verify(drive, times(1)).setDriveMessage(argThat(getArgMatcher(DRIVER_VALUE, DRIVER_VALUE))); }
@Test public void testSensorReadingLess() { when(absoluteDistanceProvider.getAbsoluteDistanceInInches()).thenReturn(DESIRED_DISTANCE_IN_INCHES * -2); boolean isDone = distanceToCommand.update(System.currentTimeMillis()); assertFalse(isDone); verify(drive, times(1)).setDriveMessage(argThat(getArgMatcher(-DRIVER_VALUE, -DRIVER_VALUE))); }
@Test public void testSensorReading() { when(absoluteDistanceProvider.getAbsoluteDistanceInInches()).thenReturn(DESIRED_DISTANCE_IN_INCHES); boolean isDone = distanceToCommand.update(System.currentTimeMillis()); assertTrue(isDone); verify(drive, never()).setDriveMessage(any(DriveMessage.class)); }