RadioButton extends FormControl { public void setLabel(String label) { ((FormRadioElement) mElement).setFormLabelAttribute(label); } RadioButton(FormRadioElement element); static RadioButton getInstanceOf(FormRadioElement element); @Override void setControlImplementation(String controlImpl); @Override String getId(); @Override void setId(String id); void setLabel(String label); String getLabel(); @Override String getName(); @Override void setName(String name); String getValue(); void setValue(String value); void setDefaultSelected(boolean isSelected); boolean getDefaultSelected(); void setCurrentSelected(boolean isSelected); boolean getCurrentSelected(); static Iterator<FormControl> getSimpleIterator(Form container);  }
@Test public void testSetLabel() { try { TextDocument textDoc = TextDocument.loadDocument(ResourceUtilities .getTestResourceAsStream("TestCreateRadioButton.odt")); Form form = textDoc.getFormByName("Test Form"); Iterator<FormControl> iterator = RadioButton .getSimpleIterator(form); RadioButton find = null; while (iterator.hasNext()) { RadioButton radio = (RadioButton) iterator.next(); if (radio.getLabel().equals("RadioButton 4")) { find = radio; break; } } Assert.assertNotNull(find); String newLabel = "Change the content of RadioButton 4."; find.setLabel(newLabel); Assert.assertEquals(newLabel, find.getLabel()); find.setLabel(null); Assert.assertEquals("", find.getLabel()); textDoc.save(ResourceUtilities .newTestOutputFile("TestSetRadioButtonLabel.odt")); } catch (Exception e) { Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(); } }