@Test public void getAnswerShouldReflectWhichSelectionWasMade() { ItemsetWidget widget = getSpyWidget(); assertNull(widget.getAnswer()); int randomIndex = Math.abs(random.nextInt()) % widget.getChoiceCount(); widget.setChoiceSelected(randomIndex, true); String selectedChoice = choices.get(Integer.toString(randomIndex)); StringData answer = (StringData) widget.getAnswer(); assertEquals(answer.getDisplayText(), selectedChoice); }
@Override public IAnswerData getAnswer() { Selection selectedItem = recyclerViewAdapter.getSelectedItems().isEmpty() ? null : recyclerViewAdapter.getSelectedItems().get(0); return selectedItem == null ? null : new StringData(selectedItem.getValue()); }
ItemsetWidget extends SelectOneWidget { @Override public IAnswerData getAnswer() { Selection selectedItem = recyclerViewAdapter.getSelectedItems().isEmpty() ? null : recyclerViewAdapter.getSelectedItems().get(0); return selectedItem == null ? null : new StringData(selectedItem.getValue()); } }
ItemsetWidget extends SelectOneWidget { @Override public IAnswerData getAnswer() { Selection selectedItem = recyclerViewAdapter.getSelectedItems().isEmpty() ? null : recyclerViewAdapter.getSelectedItems().get(0); return selectedItem == null ? null : new StringData(selectedItem.getValue()); } ItemsetWidget(Context context, QuestionDetails formEntryPrompt, boolean autoAdvanceToNext);  ItemsetWidget(Context context, ItemsetQuestionDetails formEntryPrompt, boolean autoAdvance); }
ItemsetWidget extends SelectOneWidget { @Override public IAnswerData getAnswer() { Selection selectedItem = recyclerViewAdapter.getSelectedItems().isEmpty() ? null : recyclerViewAdapter.getSelectedItems().get(0); return selectedItem == null ? null : new StringData(selectedItem.getValue()); } ItemsetWidget(Context context, QuestionDetails formEntryPrompt, boolean autoAdvanceToNext);  ItemsetWidget(Context context, ItemsetQuestionDetails formEntryPrompt, boolean autoAdvance); @Override IAnswerData getAnswer(); }
ItemsetWidget extends SelectOneWidget { @Override public IAnswerData getAnswer() { Selection selectedItem = recyclerViewAdapter.getSelectedItems().isEmpty() ? null : recyclerViewAdapter.getSelectedItems().get(0); return selectedItem == null ? null : new StringData(selectedItem.getValue()); } ItemsetWidget(Context context, QuestionDetails formEntryPrompt, boolean autoAdvanceToNext);  ItemsetWidget(Context context, ItemsetQuestionDetails formEntryPrompt, boolean autoAdvance); @Override IAnswerData getAnswer();  }