Code example for RadioButton

Methods: getText, isChecked

0
    public void testCreateSingleOption() { 
        field.setOptionStrings(new HashMap<String, List<String>>(){{put("en", Arrays.asList("one"));}});
        view.initialize(field, child); 
 
        RadioButton button = (RadioButton) view.getRadioGroup().findViewWithTag("one");
        assertThat(button.getText().toString(), equalTo("one"));
        assertThat(button.isChecked(), equalTo(false));
    } 
 
    @Test 
    public void testCreateMultipleOptions() { 
        field.setOptionStrings(new HashMap<String, List<String>>(){{put("en", Arrays.asList("one", "two", "three"));}});
        view.initialize(field, child); 
 
        assertThat(view.getRadioGroup().getChildCount(), equalTo(3)); 
        assertNotNull(view.getRadioGroup().findViewWithTag("one")); 
        assertNotNull(view.getRadioGroup().findViewWithTag("two")); 
        assertNotNull(view.getRadioGroup().findViewWithTag("three")); 
    } 
 
    @Test