### Question:
RouteProgress { public double distanceTraveled() { double distanceTraveled = directionsRoute().distance() - distanceRemaining(); if (distanceTraveled < 0) { distanceTraveled = 0; } return distanceTraveled; }  abstract DirectionsRoute directionsRoute(); abstract int legIndex(); @NonNull RouteLeg currentLeg(); double distanceTraveled(); double durationRemaining(); float fractionTraveled(); abstract double distanceRemaining(); int remainingWaypoints(); abstract RouteLegProgress currentLegProgress(); abstract List<Point> currentStepPoints(); @Nullable abstract List<Point> upcomingStepPoints(); abstract RouteProgress.Builder toBuilder(); static Builder builder();  }### Answer:
@Test public void multiLeg_getDistanceTraveled_equalsZeroAtBeginning() throws Exception { DirectionsRoute multiLegRoute = buildMultipleLegRoute(); RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); assertEquals(0, routeProgress.distanceTraveled(), BaseTest.LARGE_DELTA); }
@Test public void multiLeg_getDistanceTraveled_equalsRouteDistanceAtEndOfRoute() throws Exception { DirectionsRoute multiLegRoute = buildMultipleLegRoute(); RouteProgress routeProgress = buildEndOfMultiRouteProgress(); assertEquals(multiLegRoute.distance(), routeProgress.distanceTraveled(), BaseTest.DELTA); }
@Test public void distanceTraveled_equalsZeroAtBeginning() throws Exception { DirectionsRoute route = buildTestDirectionsRoute(); RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); assertEquals(0, beginningRouteProgress.distanceTraveled(), BaseTest.DELTA); }
@Test public void distanceTraveled_equalsRouteDistanceAtEndOfRoute() throws Exception { DirectionsRoute route = buildTestDirectionsRoute(); RouteLeg firstLeg = route.legs().get(0); RouteProgress lastRouteProgress = buildLastRouteProgress(route, firstLeg); assertEquals(route.distance(), lastRouteProgress.distanceTraveled(), BaseTest.DELTA); }