Code example for JSONArray

Methods: put, toString

0
 
        field.setOptionStrings(new HashMap<String, List<String>>(){{put("en", Arrays.asList("one", "two", "three"));}});
        view.initialize(field, child); 
 
        CheckBox checkBox1 = checkCheckBoxAtIndex(0, true);
        JSONArray options = new JSONArray();
        options.put(checkBox1.getText());
        assertEquals(options.toString(), (child.get(field.getId())).toString());
 
        CheckBox checkBox2 = checkCheckBoxAtIndex(1, true);
        options.put(checkBox2.getText());
        assertEquals(options.toString(), child.get(field.getId()).toString());
    } 
 
    @Test 
    public void testRemoveUncheckedCheckBoxValuesFromChildJSONObject() throws JSONException { 
 
        field.setOptionStrings(new HashMap<String, List<String>>(){{put("en", Arrays.asList("one", "two", "three"));}});
        view.initialize(field, child); 
 
        CheckBox checkBox1 = checkCheckBoxAtIndex(0, true);