RouteUtil { public static Integer getIcon(final Route route) { final RouteOptions.TransportMode transportMode = route.getRoutePlan() .getRouteOptions() .getTransportMode(); Integer id = 0; switch (transportMode) { case CAR: id = R.drawable.ic_drive; break; case TRUCK: id = R.drawable.ic_truck_24; break; case PEDESTRIAN: id = R.drawable.ic_walk_24; break; case BICYCLE: id = R.drawable.ic_bike_24; break; case SCOOTER: id = R.drawable.ic_scooter; break; default: break; } return id; } 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 testIcon() { Route route = new MockUtils.MockRouteBuilder().getRoute(); Integer id = RouteUtil.getIcon(route); assertThat(id, equalTo(R.drawable.ic_drive)); route = new MockUtils.MockRouteBuilder().setTransportMode(RouteOptions.TransportMode.TRUCK).getRoute(); id = RouteUtil.getIcon(route); assertThat(id, equalTo(R.drawable.ic_truck_24)); route = new MockUtils.MockRouteBuilder().setTransportMode(RouteOptions.TransportMode.PEDESTRIAN).getRoute(); id = RouteUtil.getIcon(route); assertThat(id, equalTo(R.drawable.ic_walk_24)); route = new MockUtils.MockRouteBuilder().setTransportMode(RouteOptions.TransportMode.BICYCLE).getRoute(); id = RouteUtil.getIcon(route); assertThat(id, equalTo(R.drawable.ic_bike_24)); route = new MockUtils.MockRouteBuilder().setTransportMode(RouteOptions.TransportMode.SCOOTER).getRoute(); id = RouteUtil.getIcon(route); assertThat(id, equalTo(R.drawable.ic_scooter)); }