BarcodeWidget extends QuestionWidget implements BinaryDataReceiver { @Override public void setOnLongClickListener(OnLongClickListener l) { binding.barcodeAnswerText.setOnLongClickListener(l); binding.barcodeButton.setOnLongClickListener(l); } BarcodeWidget(Context context, QuestionDetails questionDetails, WaitingForDataRegistry waitingForDataRegistry,
                         CameraUtils cameraUtils); @Override void clearAnswer(); @Override IAnswerData getAnswer(); @Override void setBinaryData(Object answer); @Override void setOnLongClickListener(OnLongClickListener l); @Override void cancelLongPress();  }
@Test public void clickingButtonAndAnswerTextViewForLong_callsLongClickListener() { BarcodeWidget widget = createWidget(promptWithAnswer(null)); widget.setOnLongClickListener(listener); widget.binding.barcodeButton.performLongClick(); widget.binding.barcodeAnswerText.performLongClick(); verify(listener).onLongClick(widget.binding.barcodeButton); verify(listener).onLongClick(widget.binding.barcodeAnswerText); }