RouteUtil { public static Spannable getDetails(final Context context, final Route route, final UnitSystem unitSystem) { final RouteOptions.TransportMode transportMode = route.getRoutePlan() .getRouteOptions() .getTransportMode(); final SpannableStringBuilder builder = new SpannableStringBuilder(getRouteLength(context, route, unitSystem)); if (transportMode == RouteOptions.TransportMode.PUBLIC_TRANSPORT) { return new SpannableStringBuilder(); } else { addVia(context, route, builder); } return builder; } 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 testDetails() { Context context = getApplicationContext(); Route route = new MockUtils.MockRouteBuilder().getRoute(); Spannable spannable = RouteUtil.getDetails(context, route, UnitSystem.METRIC); SpannableStringBuilder expectedDetails = new SpannableStringBuilder( DistanceFormatterUtil.format(getApplicationContext(), 1000, UnitSystem.METRIC)); assertThat(spannable.toString(), equalTo(expectedDetails + " RouteName")); route = new MockUtils.MockRouteBuilder().setTransportMode(RouteOptions.TransportMode.PUBLIC_TRANSPORT).getRoute(); Spannable spannable2 = RouteUtil.getDetails(context, route, UnitSystem.METRIC); assertTrue(spannable2.toString().isEmpty()); }