@Test public void testNextManeuverStreetNameWhenSignPost() { final Maneuver maneuver = MockUtils.mockManeuver(); when(maneuver.getNextRoadName()).thenReturn(MockUtils.ROAD_NAME); when(maneuver.getNextRoadNumber()).thenReturn(MockUtils.ROAD_NUMBER); when(maneuver.getAction()).thenReturn(Maneuver.Action.LEAVE_HIGHWAY); Signpost signpost = mock(Signpost.class); when(signpost.getExitNumber()).thenReturn("52"); when(maneuver.getSignpost()).thenReturn(signpost); final Context context = mock(Context.class); doAnswer(invocation -> { return invocation.getArguments()[1] + " " + invocation.getArguments()[2]; }).when(context).getString(anyInt(), Matchers.<String>anyVararg()); String street = GuidanceManeuverUtil.determineNextManeuverStreet(context, maneuver, mock(GuidanceManeuverPresenter.class)); assertThat(street, is(MockUtils.ROAD_NUMBER + " " + MockUtils.ROAD_NAME)); }
public static String determineNextManeuverStreet(Context context, Maneuver maneuver, BaseGuidancePresenter baseGuidancePresenter) { String nextManeuverStreetValue = null; if (maneuver != null) { nextManeuverStreetValue = getNextStreet(context, maneuver); if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getNextToNext(context, maneuver, baseGuidancePresenter); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { final String roadNumber = maneuver.getRoadNumber(); final String roadName = maneuver.getRoadName(); nextManeuverStreetValue = combineRoadNumberAndName(context, maneuver, roadNumber, roadName); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getSignPostExitText(maneuver); } } return nextManeuverStreetValue; }
GuidanceManeuverUtil { public static String determineNextManeuverStreet(Context context, Maneuver maneuver, BaseGuidancePresenter baseGuidancePresenter) { String nextManeuverStreetValue = null; if (maneuver != null) { nextManeuverStreetValue = getNextStreet(context, maneuver); if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getNextToNext(context, maneuver, baseGuidancePresenter); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { final String roadNumber = maneuver.getRoadNumber(); final String roadName = maneuver.getRoadName(); nextManeuverStreetValue = combineRoadNumberAndName(context, maneuver, roadNumber, roadName); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getSignPostExitText(maneuver); } } return nextManeuverStreetValue; } }
GuidanceManeuverUtil { public static String determineNextManeuverStreet(Context context, Maneuver maneuver, BaseGuidancePresenter baseGuidancePresenter) { String nextManeuverStreetValue = null; if (maneuver != null) { nextManeuverStreetValue = getNextStreet(context, maneuver); if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getNextToNext(context, maneuver, baseGuidancePresenter); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { final String roadNumber = maneuver.getRoadNumber(); final String roadName = maneuver.getRoadName(); nextManeuverStreetValue = combineRoadNumberAndName(context, maneuver, roadNumber, roadName); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getSignPostExitText(maneuver); } } return nextManeuverStreetValue; } private  GuidanceManeuverUtil(); }
GuidanceManeuverUtil { public static String determineNextManeuverStreet(Context context, Maneuver maneuver, BaseGuidancePresenter baseGuidancePresenter) { String nextManeuverStreetValue = null; if (maneuver != null) { nextManeuverStreetValue = getNextStreet(context, maneuver); if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getNextToNext(context, maneuver, baseGuidancePresenter); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { final String roadNumber = maneuver.getRoadNumber(); final String roadName = maneuver.getRoadName(); nextManeuverStreetValue = combineRoadNumberAndName(context, maneuver, roadNumber, roadName); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getSignPostExitText(maneuver); } } return nextManeuverStreetValue; } private  GuidanceManeuverUtil(); static int getIndexOfManeuver(Maneuver maneuver, List<Maneuver> maneuvers); static boolean maneuversEqual(Maneuver maneuverA, Maneuver maneuverB); static String getCurrentManeuverStreet(@NonNull Context context, @NonNull Maneuver maneuver); static String determineNextManeuverStreet(Context context, Maneuver maneuver,
            BaseGuidancePresenter baseGuidancePresenter); }
GuidanceManeuverUtil { public static String determineNextManeuverStreet(Context context, Maneuver maneuver, BaseGuidancePresenter baseGuidancePresenter) { String nextManeuverStreetValue = null; if (maneuver != null) { nextManeuverStreetValue = getNextStreet(context, maneuver); if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getNextToNext(context, maneuver, baseGuidancePresenter); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { final String roadNumber = maneuver.getRoadNumber(); final String roadName = maneuver.getRoadName(); nextManeuverStreetValue = combineRoadNumberAndName(context, maneuver, roadNumber, roadName); } if (TextUtils.isEmpty(nextManeuverStreetValue)) { nextManeuverStreetValue = getSignPostExitText(maneuver); } } return nextManeuverStreetValue; } private  GuidanceManeuverUtil(); static int getIndexOfManeuver(Maneuver maneuver, List<Maneuver> maneuvers); static boolean maneuversEqual(Maneuver maneuverA, Maneuver maneuverB); static String getCurrentManeuverStreet(@NonNull Context context, @NonNull Maneuver maneuver); static String determineNextManeuverStreet(Context context, Maneuver maneuver,
            BaseGuidancePresenter baseGuidancePresenter);  }