UrlWidget extends QuestionWidget { @Override public void setOnLongClickListener(OnLongClickListener l) { binding.urlButton.setOnLongClickListener(l); } 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 clickingButtonForLong_callsLongClickListener() { UrlWidget widget = createWidget(promptWithAnswer(null)); widget.setOnLongClickListener(listener); widget.binding.urlButton.performLongClick(); verify(listener).onLongClick(widget.binding.urlButton); }