### Question:
RouteProgress { public double durationRemaining() { return (1 - fractionTraveled()) * directionsRoute().duration(); }  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_getDurationRemaining_equalsRouteDurationAtBeginning() throws Exception { DirectionsRoute multiLegRoute = buildMultipleLegRoute(); RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); assertEquals(2858.1, routeProgress.durationRemaining(), BaseTest.LARGE_DELTA); }
@Test public void multiLeg_getDurationRemaining_equalsZeroAtEndOfRoute() throws Exception { RouteProgress routeProgress = buildEndOfMultiRouteProgress(); assertEquals(0, routeProgress.durationRemaining(), BaseTest.DELTA); }
@Test public void durationRemaining_equalsRouteDurationAtBeginning() throws Exception { DirectionsRoute route = buildTestDirectionsRoute(); RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); double durationRemaining = route.duration(); double progressDurationRemaining = beginningRouteProgress.durationRemaining(); assertEquals(durationRemaining, progressDurationRemaining, BaseTest.DELTA); }
@Test public void durationRemaining_equalsZeroAtEndOfRoute() throws Exception { DirectionsRoute route = buildTestDirectionsRoute(); RouteLeg firstLeg = route.legs().get(0); RouteProgress lastRouteProgress = buildLastRouteProgress(route, firstLeg); assertEquals(0, lastRouteProgress.durationRemaining(), BaseTest.DELTA); }