SelectionCardPresenter implements SelectableTextView.OnWordSelectedListener { public void onClipTextChanged(@NonNull String clipText) { this.selected = null; setClipText(clipText); } @Inject  SelectionCardPresenter(SelectionCardController controller, ContextHelper contextHelper); @Override void onWordSelected(String word); void onClipTextChanged(@NonNull String clipText); void addView(SelectionCardView selectionCardView); void removeView(); void onDefineClicked(); void onSearchClicked(); void onCopyClicked(); void onWikiClicked(); void onShareClicked(); void onSettingsClicked(); static boolean isLessThanNWords(String text, int n);  }
@Test public void testOnClipTextChanged() throws Exception { presenter.addView(selectionCardView); String oneWord = "one"; String twoWords = "one two"; String twoWordsWithSpace = "one two "; String text = "one two three four"; presenter.onClipTextChanged(oneWord); verify(selectionCardView).setTextForSelection(oneWord); verify(selectionCardView).selectAll(); reset(selectionCardView); presenter.onClipTextChanged(twoWords); verify(selectionCardView).setTextForSelection(twoWords); verify(selectionCardView).selectAll(); reset(selectionCardView); presenter.onClipTextChanged(twoWordsWithSpace); verify(selectionCardView).setTextForSelection(twoWords); verify(selectionCardView).selectAll(); reset(selectionCardView); presenter.onClipTextChanged(text); verify(selectionCardView).setTextForSelection(text); verify(selectionCardView, never()).selectAll(); }