### Question:
RouteUtils { @Nullable public List<Point> calculateRemainingWaypoints(RouteProgress routeProgress) { if (routeProgress.directionsRoute().routeOptions() == null) { return null; } List<Point> coordinates = new ArrayList<>(routeProgress.directionsRoute().routeOptions().coordinates()); int coordinatesSize = coordinates.size(); int remainingWaypoints = routeProgress.remainingWaypoints(); if (coordinatesSize < remainingWaypoints) { return null; } List<Point> remainingCoordinates = coordinates.subList(coordinatesSize - remainingWaypoints, coordinatesSize); return remainingCoordinates; }  boolean isNewRoute(@Nullable RouteProgress previousRouteProgress,
                            @NonNull RouteProgress routeProgress); boolean isNewRoute(@Nullable RouteProgress previousRouteProgress,
                            @NonNull DirectionsRoute directionsRoute); boolean isArrivalEvent(@NonNull RouteProgress routeProgress, @NonNull Milestone milestone); boolean isLastLeg(RouteProgress routeProgress); @Nullable List<Point> calculateRemainingWaypoints(RouteProgress routeProgress); @Nullable String[] calculateRemainingWaypointNames(RouteProgress routeProgress); Location createFirstLocationFromRoute(DirectionsRoute route); boolean isValidRouteProfile(String routeProfile); @Nullable BannerInstructions findCurrentBannerInstructions(LegStep currentStep, double stepDistanceRemaining); @Nullable BannerText findCurrentBannerText(LegStep currentStep, double stepDistanceRemaining,
                                          boolean findPrimary); @Nullable VoiceInstructions findCurrentVoiceInstructions(LegStep currentStep, double stepDistanceRemaining);  }### Answer:
@Test public void calculateRemainingWaypoints() { DirectionsRoute route = mock(DirectionsRoute.class); RouteOptions routeOptions = mock(RouteOptions.class); when(routeOptions.coordinates()).thenReturn(buildCoordinateList()); when(route.routeOptions()).thenReturn(routeOptions); RouteProgress routeProgress = mock(RouteProgress.class); when(routeProgress.remainingWaypoints()).thenReturn(2); when(routeProgress.directionsRoute()).thenReturn(route); RouteUtils routeUtils = new RouteUtils(); List<Point> remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); assertEquals(2, remainingWaypoints.size()); assertEquals(Point.fromLngLat(7.890, 1.234), remainingWaypoints.get(0)); assertEquals(Point.fromLngLat(5.678, 9.012), remainingWaypoints.get(1)); }
@Test public void calculateRemainingWaypoints_handlesNullOptions() { DirectionsRoute route = mock(DirectionsRoute.class); when(route.routeOptions()).thenReturn(null); RouteProgress routeProgress = mock(RouteProgress.class); when(routeProgress.remainingWaypoints()).thenReturn(2); when(routeProgress.directionsRoute()).thenReturn(route); RouteUtils routeUtils = new RouteUtils(); List<Point> remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); assertNull(remainingWaypoints); }