Search in sources :

Example 1 with ItemsetWidgetTest

use of org.odk.collect.android.widgets.ItemsetWidgetTest in project collect by opendatakit.

the class QuestionWidgetTest method getAnswerShouldReturnExistingAnswerIfPromptHasExistingAnswer.

@Test
public void getAnswerShouldReturnExistingAnswerIfPromptHasExistingAnswer() {
    A answer = getInitialAnswer();
    if (answer instanceof StringData && !(this instanceof ItemsetWidgetTest)) {
        when(formEntryPrompt.getAnswerText()).thenReturn((String) answer.getValue());
    } else {
        when(formEntryPrompt.getAnswerValue()).thenReturn(answer);
    }
    W widget = getWidget();
    IAnswerData newAnswer = widget.getAnswer();
    assertNotNull(newAnswer);
    assertEquals(newAnswer.getDisplayText(), answer.getDisplayText());
}
Also used : IAnswerData(org.javarosa.core.model.data.IAnswerData) ItemsetWidgetTest(org.odk.collect.android.widgets.ItemsetWidgetTest) StringData(org.javarosa.core.model.data.StringData) Test(org.junit.Test) ItemsetWidgetTest(org.odk.collect.android.widgets.ItemsetWidgetTest)

Aggregations

IAnswerData (org.javarosa.core.model.data.IAnswerData)1 StringData (org.javarosa.core.model.data.StringData)1 Test (org.junit.Test)1 ItemsetWidgetTest (org.odk.collect.android.widgets.ItemsetWidgetTest)1