### Question:
ExpandedView extends FrameLayout { public void setSelected(Page selected) { final int childCount = iconsHolder.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = iconsHolder.getChildAt(i); final boolean isSelected = ObjectUtil.equals(child.getTag(), selected.getId()); child.setSelected(isSelected); if (isSelected) { setupArrowPosition(child); } } setupPage(selected); title.setText(selected.getTitle()); } ExpandedView(@NonNull Context context);  ExpandedView(@NonNull Context context, ExpandedViewCallback callback);  ExpandedView(@NonNull Context context, @Nullable AttributeSet attrs);  ExpandedView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr); void displayPages(List<Page> pages, Page selected, boolean animated); void setSelected(Page selected); void setCallback(ExpandedViewCallback callback); void destroyContentAnimated(@Nullable Runnable runnable); void destroyContent(); @Override boolean dispatchKeyEvent(KeyEvent event); static final int BACGROUND_TRANSPARENT_COLOR_RES; }### Answer:
@Test public void setSelected() throws Exception { View pageView1 = mock(View.class, withSettings().extraInterfaces(PageView.class)); View pageView2 = mock(View.class, withSettings().extraInterfaces(PageView.class)); List<Page> pages = ImmutableList.of( new Page("page1", R.drawable.ic_share, "page1", (context, overlayCallback) -> pageView1), new Page("page2", R.drawable.ic_share, "page2", (context, overlayCallback) -> pageView2) ); view.displayPages(pages, pages.get(0), false); ViewGroup iconHolder = view.findViewById(R.id.tab_icons_holder); Page selectedPage = pages.get(1); view.setSelected(selectedPage); for (int i = 0; i < iconHolder.getChildCount(); i++) { View child = iconHolder.getChildAt(i); assertTrue(child.isSelected() == ObjectUtil.equals(child.getTag(), selectedPage.getId())); } View selectedView = iconHolder.findViewWithTag(selectedPage.getId()); assertEquals(selectedPage.getId(), selectedView.getTag()); }