ManeuverResources { public String getManeuverInstruction(final int index) { final Maneuver maneuver = getManeuverAt(index); if (maneuver == null) { return ""; } String instruction = getInstruction(maneuver); if (instruction == null || TextUtils.isEmpty(instruction)) { instruction = mContext.getString(R.string.msdkui_maneuver_head_to, getLocalizedOrientation(mContext, maneuver .getMapOrientation())); } return instruction; } @SuppressWarnings("PMD.NcssCount") // There is no purpose to break this constuctor into smaller functions. /** * Constructs a new instance using a list of maneuvers. */  ManeuverResources(final Context context, final List<Maneuver> maneuverList); int getStartIconId(); int getDestinationIconId(); int getManeuverIconId(final int index); String getManeuverInstruction(final int index); int getDistanceFromNext(final int index); String getRoadToDisplay(final int index); String getExitDirections(final Maneuver maneuver); String getString(final Integer id); String getArrivedAtDestinationInstruction();  }
@Test public void testManeuverActionFerryForCarShuttleTrains() { Maneuver maneuver = mock(Maneuver.class); when(maneuver.getAction()).thenReturn(Action.FERRY); when(maneuver.getIcon()).thenReturn(com.here.android.mpa.routing.Maneuver.Icon.FERRY); RoadElement carShuttleRoadElement = mock(RoadElement.class); when(carShuttleRoadElement.getAttributes()).thenReturn(EnumSet.of(RoadElement.Attribute.CAR_SHUTTLE_TRAIN, RoadElement.Attribute .FERRY)); when(maneuver.getRoadElements()).thenReturn(Collections.singletonList(carShuttleRoadElement)); mManeuverResources = new ManeuverResources(getApplicationContext(), new ArrayList<>(Collections.singletonList(maneuver))); assertThat(mManeuverResources.getManeuverInstruction(0), equalTo(getStringFromContext(R.string.msdkui_maneuver_enter_car_shuttle_train))); }
@Test public void testNullManeuver() { mManeuverResources = new ManeuverResources(getApplicationContext(), null); String maneuverInstruction = mManeuverResources.getManeuverInstruction(-1); assertThat(maneuverInstruction, is(isEmptyString())); maneuverInstruction = mManeuverResources.getManeuverInstruction(0); assertThat(maneuverInstruction, is(isEmptyString())); }