RouteUtil { public static String getArrivalTime(final Context context, final Route route, final boolean isTraffic) { final long tta = getTta(route, isTraffic); final Date setArrivalOrDepartureDate = new Date(); final Date estimatedArrival; final RouteOptions.TimeType type = route.getRoutePlan().getRouteOptions().getTime(setArrivalOrDepartureDate); if (type == RouteOptions.TimeType.ARRIVAL) { estimatedArrival = new Date(setArrivalOrDepartureDate.getTime() - tta); } else { estimatedArrival = new Date(setArrivalOrDepartureDate.getTime() + tta); } return DateFormatterUtil.format(context, estimatedArrival); } private  RouteUtil(); static String getLongestRoadSegments(final Route route); static Spannable getTrafficDelayed(final Context context, final Route route); static String getArrivalTime(final Context context, final Route route, final boolean isTraffic); static String getRouteLength(final Context context, final Route route,
                                        final UnitSystem unitSystem); static Spannable getDetails(final Context context, final Route route,
                                       final UnitSystem unitSystem); static Spannable getTimeToArrive(final Context context, final Route route, final boolean isTraffic); static Integer getIcon(final Route route); static List<SectionModel> getSectionBar(final Context context, final Route route);  }
@Test public void testArrivalTime() { Context context = getApplicationContext(); Route route = new MockUtils.MockRouteBuilder().getRoute(); long currentTimeInMs = new Date().getTime(); String arrivalTime = RouteUtil.getArrivalTime(context, route, false); assertThat(arrivalTime, equalTo(DateFormatterUtil.format(getApplicationContext(), new Date(currentTimeInMs + 1000 * DateUtils.SECOND_IN_MILLIS)))); int penaltyMinutes = 5; route = new MockUtils.MockRouteBuilder().setTrafficPenaltyMinutes(penaltyMinutes).getRoute(); arrivalTime = RouteUtil.getArrivalTime(context, route, true); assertThat(arrivalTime, equalTo(DateFormatterUtil.format(getApplicationContext(), new Date(currentTimeInMs + penaltyMinutes * DateUtils.MINUTE_IN_MILLIS)))); }