EnterDeckDestinationPresenter { public void refreshView() { updateNextButtonState(); populateLanguageChips(); } EnterDeckDestinationPresenter(EnterDeckDestinationView view, NewDeckContext contextFromIntent); void setBitmaps(); void deleteLanguage(String language); void newLanguageSelected(String selectedLanguage); void nextButtonClicked(); void backButtonClicked(); void refreshView(); void addNewDestinationLanguageClicked();  }
@Test public void shouldSetNextButtonClickableWhenDestinationLanguagesExist() { HashSet<String> destinationLanguages = new HashSet<String>() {{ add(A_LANGUAGE); }}; when(newDeckContext.getDestinationLanguages()).thenReturn(destinationLanguages); presenter.refreshView(); verify(view).enableNextButton(); }
@Test public void shouldSetNextButtonToNotClickableWhenNoDestinationLanguagesArePresent() { when(newDeckContext.getDestinationLanguages()).thenReturn(new HashSet<String>()); presenter.refreshView(); verify(view).disableNextButton(); }
@Test public void shouldAddLanguagesToViewWhenPopulatingLanguageList() { HashSet<String> destinationLanguages = new HashSet<String>() {{ add(A_LANGUAGE); }}; when(newDeckContext.getDestinationLanguages()).thenReturn(destinationLanguages); presenter.refreshView(); verify(view).removeAllLanguageChips(); verify(view).addLanguageChip(A_LANGUAGE); }
@Test public void shouldNotAddLanguageChipsToViewWhenNoLanguagesExist() { presenter.refreshView(); verify(view).removeAllLanguageChips(); verify(view, times(0)).addLanguageChip(anyString()); }