@Test public void showTabs_withBioAndAccomplishmentsTab() { final UserProfileTab userProfileTab = new UserProfileTab(R.string.profile_tab_bio, UserProfileBioFragment.class); final UserProfileTab accomplishmentsTab = new UserProfileTab(R.string.profile_tab_accomplishment, UserProfileAccomplishmentsFragment.class); final List<UserProfileTab> tabs = Arrays.asList(userProfileTab, accomplishmentsTab); view.showTabs(tabs); verify(fragment.mockAdapter).setItems(UserProfileFragment.pagerItemsFromProfileTabs(tabs, fragment.getResources())); assertThat(binding.profileSectionTabs).isVisible(); }
@NonNull @VisibleForTesting public static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources) { final List<FragmentItemModel> pages = new LinkedList<>(); for (UserProfileTab tab : tabs) { pages.add(new FragmentItemModel(tab.getFragmentClass(), resources.getString(tab.getDisplayName()))); } return pages; }
UserProfileFragment extends PresenterFragment<UserProfilePresenter, UserProfilePresenter.ViewInterface> implements UserProfileBioTabParent, ScrollingPreferenceParent, RefreshListener, StaticFragmentPagerAdapter.FragmentLifecycleCallbacks { @NonNull @VisibleForTesting public static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources) { final List<FragmentItemModel> pages = new LinkedList<>(); for (UserProfileTab tab : tabs) { pages.add(new FragmentItemModel(tab.getFragmentClass(), resources.getString(tab.getDisplayName()))); } return pages; } }
UserProfileFragment extends PresenterFragment<UserProfilePresenter, UserProfilePresenter.ViewInterface> implements UserProfileBioTabParent, ScrollingPreferenceParent, RefreshListener, StaticFragmentPagerAdapter.FragmentLifecycleCallbacks { @NonNull @VisibleForTesting public static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources) { final List<FragmentItemModel> pages = new LinkedList<>(); for (UserProfileTab tab : tabs) { pages.add(new FragmentItemModel(tab.getFragmentClass(), resources.getString(tab.getDisplayName()))); } return pages; }  }
UserProfileFragment extends PresenterFragment<UserProfilePresenter, UserProfilePresenter.ViewInterface> implements UserProfileBioTabParent, ScrollingPreferenceParent, RefreshListener, StaticFragmentPagerAdapter.FragmentLifecycleCallbacks { @NonNull @VisibleForTesting public static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources) { final List<FragmentItemModel> pages = new LinkedList<>(); for (UserProfileTab tab : tabs) { pages.add(new FragmentItemModel(tab.getFragmentClass(), resources.getString(tab.getDisplayName()))); } return pages; }  @NonNull static UserProfileFragment newInstance(@NonNull String username); @NonNull @VisibleForTesting static Bundle createArguments(@NonNull String username); @Nullable @Override View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override void onCreateOptionsMenu(Menu menu, MenuInflater inflater); @Override boolean onOptionsItemSelected(MenuItem item); @Override UserProfileBioInteractor getBioInteractor(); @Override void onChildScrollingPreferenceChanged(); @NonNull @VisibleForTesting static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources); @Override void onRefresh(); @SuppressWarnings("unused") void onEvent(NetworkConnectivityChangeEvent event); @Override void onDetach(); @Override void onFragmentInstantiate(); }
UserProfileFragment extends PresenterFragment<UserProfilePresenter, UserProfilePresenter.ViewInterface> implements UserProfileBioTabParent, ScrollingPreferenceParent, RefreshListener, StaticFragmentPagerAdapter.FragmentLifecycleCallbacks { @NonNull @VisibleForTesting public static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources) { final List<FragmentItemModel> pages = new LinkedList<>(); for (UserProfileTab tab : tabs) { pages.add(new FragmentItemModel(tab.getFragmentClass(), resources.getString(tab.getDisplayName()))); } return pages; }  @NonNull static UserProfileFragment newInstance(@NonNull String username); @NonNull @VisibleForTesting static Bundle createArguments(@NonNull String username); @Nullable @Override View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override void onCreateOptionsMenu(Menu menu, MenuInflater inflater); @Override boolean onOptionsItemSelected(MenuItem item); @Override UserProfileBioInteractor getBioInteractor(); @Override void onChildScrollingPreferenceChanged(); @NonNull @VisibleForTesting static List<FragmentItemModel> pagerItemsFromProfileTabs(@NonNull List<UserProfileTab> tabs, @NonNull Resources resources); @Override void onRefresh(); @SuppressWarnings("unused") void onEvent(NetworkConnectivityChangeEvent event); @Override void onDetach(); @Override void onFragmentInstantiate();  }