@Test public void shouldRenderCurrentMonthsFragment() throws Exception { presenter.onItemSelected(THIS_MONTH); ArgumentCaptor<CurrentMonthExpenseFragment> fragmentCaptor = ArgumentCaptor.forClass(CurrentMonthExpenseFragment.class); verify(view).render(fragmentCaptor.capture()); CurrentMonthExpenseFragment fragment = fragmentCaptor.getValue(); assertTrue(fragment.getClass().equals(CurrentMonthExpenseFragment.class)); }
public void onItemSelected(String drawerItem) { switch (drawerItem){ case THIS_WEEK: view.render(new CurrentWeekExpenseFragment()); break; case THIS_MONTH: view.render(new CurrentMonthExpenseFragment()); break; case HOME: view.goToHome(); break; } }
NavigationDrawerPresenter { public void onItemSelected(String drawerItem) { switch (drawerItem){ case THIS_WEEK: view.render(new CurrentWeekExpenseFragment()); break; case THIS_MONTH: view.render(new CurrentMonthExpenseFragment()); break; case HOME: view.goToHome(); break; } } }
NavigationDrawerPresenter { public void onItemSelected(String drawerItem) { switch (drawerItem){ case THIS_WEEK: view.render(new CurrentWeekExpenseFragment()); break; case THIS_MONTH: view.render(new CurrentMonthExpenseFragment()); break; case HOME: view.goToHome(); break; } } NavigationDrawerPresenter(NavigationDrawerItemView view); }
NavigationDrawerPresenter { public void onItemSelected(String drawerItem) { switch (drawerItem){ case THIS_WEEK: view.render(new CurrentWeekExpenseFragment()); break; case THIS_MONTH: view.render(new CurrentMonthExpenseFragment()); break; case HOME: view.goToHome(); break; } } NavigationDrawerPresenter(NavigationDrawerItemView view); void onItemSelected(String drawerItem); }
NavigationDrawerPresenter { public void onItemSelected(String drawerItem) { switch (drawerItem){ case THIS_WEEK: view.render(new CurrentWeekExpenseFragment()); break; case THIS_MONTH: view.render(new CurrentMonthExpenseFragment()); break; case HOME: view.goToHome(); break; } } NavigationDrawerPresenter(NavigationDrawerItemView view); void onItemSelected(String drawerItem); static final String THIS_WEEK; static final String THIS_MONTH; static final String HOME; }