GuidanceStreetLabelView extends LinearLayout { public void setCurrentStreetData(@Nullable final GuidanceStreetLabelData currentStreetData) { mGuidanceStreetLabelData = currentStreetData; if (currentStreetData == null || currentStreetData.getCurrentStreetName() == null || currentStreetData.getCurrentStreetName().isEmpty()) { setVisibility(GONE); return; } else { setVisibility(VISIBLE); } final TextView currentStreetLabelView = findViewById(R.id.guidance_current_street_text); currentStreetLabelView.setText(currentStreetData.getCurrentStreetName()); refresh(); } GuidanceStreetLabelView(Context context);  GuidanceStreetLabelView(Context context, @Nullable AttributeSet attrs);  GuidanceStreetLabelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceStreetLabelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); void setCurrentStreetData(@Nullable final GuidanceStreetLabelData currentStreetData); void refresh(); GuidanceStreetLabelData getGuidanceCurrentStreetData(); @Override void onRestoreInstanceState(Parcelable state);  }
@Test public void testVisibilityOfView() { mGuidanceStreetLabelView.setCurrentStreetData(null); assertEquals(mGuidanceStreetLabelView.getVisibility(), View.GONE); }
@Test public void testSetCurrentStreetData() { final GuidanceStreetLabelData currentStreetData = new GuidanceStreetLabelData(STREET_NAME, COLOR); mGuidanceStreetLabelView.setCurrentStreetData(currentStreetData); assertEquals(currentStreetData.getCurrentStreetName(), mGuidanceStreetLabelView.getGuidanceCurrentStreetData().getCurrentStreetName()); assertEquals(currentStreetData.getBackgroundColor(), mGuidanceStreetLabelView.getGuidanceCurrentStreetData().getBackgroundColor()); }