SortingDialogPresenterImpl implements SortingDialogPresenter { @Override public void setLastSavedOption() { if (isViewAttached()) { int selectedOption = sortingDialogInteractor.getSelectedSortingOption(); if (selectedOption == SortType.MOST_POPULAR.getValue()) { view.setPopularChecked(); } else if (selectedOption == SortType.HIGHEST_RATED.getValue()) { view.setHighestRatedChecked(); } else if (selectedOption == SortType.NEWEST.getValue()) { view.setNewestChecked(); } else { view.setFavoritesChecked(); } } } SortingDialogPresenterImpl(SortingDialogInteractor interactor); @Override void setView(SortingDialogView view); @Override void destroy(); @Override void setLastSavedOption(); @Override void onPopularMoviesSelected(); @Override void onHighestRatedMoviesSelected(); @Override void onNewestMoviesSelected(); @Override void onFavoritesSelected();  }
@Test public void shouldCheckNewestMoviesIfLastSavedOptionIsHighestRated() throws Exception { when(interactor.getSelectedSortingOption()).thenReturn(SortType.NEWEST.getValue()); presenter.setLastSavedOption(); verify(view).setNewestChecked(); }
@Test public void shouldCheckPopularIfLastSavedOptionIsPopular() throws Exception { when(interactor.getSelectedSortingOption()).thenReturn(SortType.MOST_POPULAR.getValue()); presenter.setLastSavedOption(); verify(view).setPopularChecked(); }
@Test public void shouldCheckHighestRatedIfLastSavedOptionIsHighestRated() throws Exception { when(interactor.getSelectedSortingOption()).thenReturn(SortType.HIGHEST_RATED.getValue()); presenter.setLastSavedOption(); verify(view).setHighestRatedChecked(); }
@Test public void shouldCheckFavoritesIfLastSavedOptionIsFavorites() throws Exception { when(interactor.getSelectedSortingOption()).thenReturn(SortType.FAVORITES.getValue()); presenter.setLastSavedOption(); verify(view).setFavoritesChecked(); }