UrlWidget extends QuestionWidget { @Override public void clearAnswer() { ToastUtils.showShortToast("URL is readonly"); } UrlWidget(Context context, QuestionDetails questionDetails, CustomTabHelper customTabHelper); @Override void clearAnswer(); @Override IAnswerData getAnswer(); @Override void setOnLongClickListener(OnLongClickListener l); @Override void cancelLongPress(); void onButtonClick();  }
@Test public void clearAnswer_showsToastThatTheUrlIsReadOnly() { UrlWidget widget = createWidget(promptWithAnswer(new StringData("blah"))); widget.clearAnswer(); assertThat(ShadowToast.getTextOfLatestToast(), equalTo("URL is readonly")); }