EnterDeckDestinationPresenter { public void newLanguageSelected(String selectedLanguage) { if (selectedLanguage != null) { contextFromIntent.addDestinationLanguage(selectedLanguage); view.addLanguageChip(selectedLanguage); updateNextButtonState(); } } 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 shouldNotAddNewLanguageChipWhenSelectedLanguageIsNull() { presenter.newLanguageSelected(null); assertEquals(new HashSet<String>(), newDeckContext.getDestinationLanguages()); verifyZeroInteractions(view); }
@Test public void shouldAddNewLanguageChipToViewWhenANewLanguageIsSelected() { when(newDeckContext.getDestinationLanguages()).thenReturn(new HashSet<>(Collections.singletonList("Some Language"))); presenter.newLanguageSelected(A_LANGUAGE); verify(newDeckContext).addDestinationLanguage(A_LANGUAGE); verify(view).addLanguageChip(A_LANGUAGE); verify(view).enableNextButton(); }