EnterDeckDestinationLanguagesActivity extends AddDeckActivity implements EnterDeckDestinationPresenter.EnterDeckDestinationView { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { String selectedLanguage = data.getStringExtra(LanguageSelectorActivity.SELECTED_LANGUAGE_KEY); presenter.newLanguageSelected(selectedLanguage); } super.onActivityResult(requestCode, resultCode, data); }  @Override void inflateView(); @Override void setBitmapsForActivity(); @Override void initStates(); @OnClick(R.id.next_button) void nextButtonClicked(); @OnClick(R.id.enter_destination_back_arrow) void backButtonClicked(); @OnClick(R.id.add_language_button) void showLanguageSelector(); @Override void enableNextButton(); @Override void disableNextButton(); @Override void addLanguageChip(final String language); @Override void removeAllLanguageChips();  }
@Test public void shouldNotAddLanguageSelectorResultIfInvalidResultCode() { NewDeckContext newDeckContext = new NewDeckContext(new Deck()); EnterDeckDestinationLanguagesActivity activity = (EnterDeckDestinationLanguagesActivity) helper.createActivityToTestWithContext(newDeckContext); FlexboxLayout flexBox = (FlexboxLayout) activity.findViewById(R.id.language_chip_flexbox); Intent data = new Intent(); data.putExtra(LanguageSelectorActivity.SELECTED_LANGUAGE_KEY, "English"); int requestCode = 0; activity.onActivityResult(requestCode, Activity.RESULT_CANCELED, data); assertEquals(0, flexBox.getChildCount()); assertEquals(0, newDeckContext.getDestinationLanguages().size()); }