Search in sources :

Example 26 with Selection

use of org.javarosa.core.model.data.helper.Selection in project javarosa by opendatakit.

the class SelectMultiDataTests method testBadDataTypes.

public void testBadDataTypes() {
    boolean failure = false;
    SelectMultiData data = new SelectMultiData(firstTwo);
    try {
        data.setValue(invalid);
        data = new SelectMultiData(invalid);
    } catch (Exception e) {
        failure = true;
    }
    assertTrue("SelectMultiData did not throw a proper exception while being set to invalid data.", failure);
    Selection[] values = new Selection[firstTwo.size()];
    firstTwo.toArray(values);
    assertVectorIdentity("Ensure not overwritten: ", (List<Selection>) data.getValue(), values);
}
Also used : SelectMultiData(org.javarosa.core.model.data.SelectMultiData) Selection(org.javarosa.core.model.data.helper.Selection)

Aggregations

Selection (org.javarosa.core.model.data.helper.Selection)26 SelectMultiData (org.javarosa.core.model.data.SelectMultiData)14 ArrayList (java.util.ArrayList)13 SelectChoice (org.javarosa.core.model.SelectChoice)12 List (java.util.List)8 SelectOneData (org.javarosa.core.model.data.SelectOneData)8 QuestionDef (org.javarosa.core.model.QuestionDef)4 Constraint (org.javarosa.core.model.condition.Constraint)4 IAnswerData (org.javarosa.core.model.data.IAnswerData)4 SuppressLint (android.annotation.SuppressLint)3 NonNull (android.support.annotation.NonNull)2 EvaluationContext (org.javarosa.core.model.condition.EvaluationContext)2 ConstraintHint (org.javarosa.core.model.condition.pivot.ConstraintHint)2 DateData (org.javarosa.core.model.data.DateData)2 DateTimeData (org.javarosa.core.model.data.DateTimeData)2 TreeElement (org.javarosa.core.model.instance.TreeElement)2 TreeReference (org.javarosa.core.model.instance.TreeReference)2 Test (org.junit.Test)2 ImmutableList (com.google.common.collect.ImmutableList)1 BigDecimal (java.math.BigDecimal)1