ManeuverItemView extends BaseView { public void setManeuver(final List<Maneuver> maneuvers, final int pos) { if (maneuvers == null) { throw new IllegalArgumentException( getContext().getString(R.string.msdkui_exception_maneuvres_null)); } if (pos < 0 || pos > maneuvers.size()) { throw new IllegalArgumentException( getContext().getString(R.string.msdkui_exception_maneuver_pos_invalid)); } final ManeuverResources maneuverResources = new ManeuverResources(getContext(), maneuvers); mManeuver = maneuvers.get(pos); final ImageView icon = (ImageView) mSections.get(Section.ICON); final int id = maneuverResources.getManeuverIconId(pos); if (id == 0) { icon.setVisibility(View.GONE); } else { icon.setImageResource(id); } icon.setTag(id); final TextView instructionView = (TextView) mSections.get(Section.INSTRUCTIONS); instructionView.setText(maneuverResources.getManeuverInstruction(pos)); final TextView addressView = (TextView) mSections.get(Section.ADDRESS); addressView.setText(maneuverResources.getRoadToDisplay(pos)); final TextView distanceView = (TextView) mSections.get(Section.DISTANCE); final int distance = maneuverResources.getDistanceFromNext(pos); if (distance == 0) { distanceView.setVisibility(GONE); } else { distanceView.setVisibility(VISIBLE); distanceView.setText(DistanceFormatterUtil.format(getContext(), distance, mUnitSystem)); } if (getVisibility() == INVISIBLE) { setVisibility(View.VISIBLE); } } ManeuverItemView(final Context context);  ManeuverItemView(final Context context, final AttributeSet attrs);  ManeuverItemView(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  ManeuverItemView(final Context context, final AttributeSet attrs, final int defStyleAttr,
                            final int defStyleRes); void setSectionVisible(final Section section, final boolean visible); boolean isSectionVisible(final Section section); Set<Section> getVisibleSections(); void setVisibleSections(final EnumSet<Section> sectionEnumSet); Maneuver getManeuver(); void setManeuver(final List<Maneuver> maneuvers, final int pos);  }
@Test(expected = IllegalArgumentException.class) public void settingNullManeuverShouldThrowException() { mManeuverItemView.setManeuver(null, 0); }
@Test(expected = IllegalArgumentException.class) public void setManeuverIncorrectPositionShouldThrowException() { mManeuverItemView.setManeuver(getManeuvers(), -1); }