CheckBox extends FormControl { public void setValue(String value) { ((FormCheckboxElement) mElement).setFormValueAttribute(value); } CheckBox(FormCheckboxElement element); static CheckBox getInstanceOf(FormCheckboxElement 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); void setValue(String value); String getValue(); void setDefaultState(FormCheckboxState state); FormCheckboxState getDefaultState(); void setCurrentState(FormCheckboxState state); FormCheckboxState getCurrentState(); static Iterator<FormControl> getSimpleIterator(Form container);  }
@Test public void testSetValue() { try { String testFileName = "TestSetCheckBoxValue"; createForm(testFileName + ".odt"); TextDocument textDoc = TextDocument.loadDocument(ResourceUtilities .getTestResourceAsStream(testFileName + ".odt")); Form form = textDoc.getFormByName("Test Form"); Iterator<FormControl> iterator = CheckBox.getSimpleIterator(form); CheckBox find = null; while (iterator.hasNext()) { CheckBox btn = (CheckBox) iterator.next(); if (btn.getName().equals("CheckBox 1")) { find = btn; break; } } Assert.assertNotNull(find); Assert.assertEquals("1", find.getValue()); find.setValue("15"); Assert.assertEquals("15", find.getValue()); textDoc.save(ResourceUtilities .newTestOutputFile(testFileName + "_OUT.odt")); } catch (Exception e) { Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'"); } }