EnterDeckDestinationPresenter { public void deleteLanguage(String language) { contextFromIntent.getDestinationLanguages().remove(language); refreshView(); } 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 shouldRemoveALanguageChipAndRepopulateFlexboxWhenALanguageIsDeleted() { final String anotherLanguage = "Another Language"; HashSet<String> destinationLanguages = new HashSet<String>() {{ add(A_LANGUAGE); add(anotherLanguage); }}; when(newDeckContext.getDestinationLanguages()).thenReturn(destinationLanguages); presenter.deleteLanguage(A_LANGUAGE); assertFalse(newDeckContext.getDestinationLanguages().contains(A_LANGUAGE)); verify(view).removeAllLanguageChips(); verify(view).addLanguageChip(anotherLanguage); }
@Test public void shouldDisableNextButtonWhenAllLanguageChipsAreDeleted() { HashSet<String> destinationLanguages = new HashSet<String>() {{ add(A_LANGUAGE); }}; when(newDeckContext.getDestinationLanguages()).thenReturn(destinationLanguages); presenter.deleteLanguage(A_LANGUAGE); verify(view).disableNextButton(); }