Label extends FormControl { public void setLabel(String label) { ((FormFixedTextElement) mElement).setFormLabelAttribute(label); } Label(FormFixedTextElement element); static Label getInstanceOf(FormFixedTextElement element); @Override void setControlImplementation(String controlImpl); @Override String getId(); @Override void setId(String id); @Override String getName(); @Override void setName(String name); void setLabel(String label); String getLabel(); static Iterator<FormControl> getSimpleIterator(Form container);  }
@Test public void testSetLabel() { try { TextDocument textDoc = TextDocument.loadDocument(ResourceUtilities .getTestResourceAsStream("TestCreateLabel.odt")); Form form = textDoc.getFormByName("Test Form"); Iterator<FormControl> iterator = Label.getSimpleIterator(form); Label find = null; while (iterator.hasNext()) { Label label = (Label) iterator.next(); if (label.getName().equals("Label3")) { find = label; break; } } Assert.assertNotNull(find); String newLabel = "Change the content of Label 4."; find.setLabel(newLabel); Assert.assertEquals(newLabel, find.getLabel()); find.setLabel(null); Assert.assertEquals("", find.getLabel()); textDoc.save(ResourceUtilities .newTestOutputFile("TestSetLabelLabel.odt")); } catch (Exception e) { Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(); } }