RouteDescriptionItem extends BaseView { public boolean isSectionVisible(final Section section) { return mSections.get(section).getVisibility() == VISIBLE; } RouteDescriptionItem(final Context context);  RouteDescriptionItem(final Context context, final AttributeSet attrs);  RouteDescriptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  RouteDescriptionItem(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); EnumSet<Section> getVisibleSections(); void setVisibleSections(final EnumSet<Section> sectionEnumSet); boolean isTrafficEnabled(); void setTrafficEnabled(final boolean isTraffic); Route getRoute(); void setRoute(final Route route); float getSectionBarScaling(); void setSectionBarScaling(final float sectionBarScaling); boolean isBikeOrPedestrian();  }
@Test public void testCreationWithTypeSectionVisible() { AttributeSet attributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.visibleSection, "typeIcon") .build(); RouteDescriptionItem item = new RouteDescriptionItem(getContextWithTheme(), attributeSet); assertNotNull(item); assertTrue(item.isSectionVisible(RouteDescriptionItem.Section.TYPE_ICON)); }
@Test public void testCreationWithTimeSectionVisible() { AttributeSet attributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.visibleSection, "time") .build(); RouteDescriptionItem item = new RouteDescriptionItem(getContextWithTheme(), attributeSet); assertNotNull(item); assertTrue(item.isSectionVisible(RouteDescriptionItem.Section.TIME)); }
@Test public void testCreationWithDetailsSectionVisible() { AttributeSet attributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.visibleSection, "details") .build(); RouteDescriptionItem item = new RouteDescriptionItem(getContextWithTheme(), attributeSet); assertNotNull(item); assertTrue(item.isSectionVisible(RouteDescriptionItem.Section.DETAILS)); }
@Test public void testCreationWithTrafficWarningSectionVisible() { AttributeSet attributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.visibleSection, "trafficWarning") .build(); RouteDescriptionItem item = new RouteDescriptionItem(getContextWithTheme(), attributeSet); assertNotNull(item); assertTrue(item.isSectionVisible(RouteDescriptionItem.Section.TRAFFIC_WARNING)); }
@Test public void testCreationWithArrivalTimeSectionVisible() { AttributeSet attributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.visibleSection, "arrivalTime") .build(); RouteDescriptionItem item = new RouteDescriptionItem(getContextWithTheme(), attributeSet); assertNotNull(item); assertTrue(item.isSectionVisible(RouteDescriptionItem.Section.ARRIVAL_TIME)); }
@Test public void testCreationWithBarSectionVisible() { AttributeSet attributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.visibleSection, "sectionBar") .build(); RouteDescriptionItem item = new RouteDescriptionItem(getContextWithTheme(), attributeSet); assertNotNull(item); assertTrue(item.isSectionVisible(RouteDescriptionItem.Section.SECTION_BAR)); }