BodyImpl extends XliffElementImpl implements Body { public List<? extends StructuralUnit> getStructuralUnits() { return Collections.unmodifiableList(children); } BodyImpl(List<? extends StructuralUnit> children);  BodyImpl(org.w3c.dom.Element element); @Override List<? extends Node> getChildren(); List<? extends StructuralUnit> getStructuralUnits(); void setStructuralUnits(List<? extends StructuralUnit> children);  }
@Test public void testBodyImplListOfQextendsStructuralUnit() { BodyImpl body = createDefaultBody(); assertEquals(createDefaultStructuralUnits(), body.getStructuralUnits()); }
@Test public void testBodyImplElement() { Document doc = Utils.createDocument(); Element elem = doc.createElementNS(XLIFF_12_NAMESPACE, "body"); elem.appendChild(createEmptyGroup().asXmlNode(doc)); elem.appendChild(createDefaultTransUnit().asXmlNode(doc)); elem.appendChild(createDefaultBinUnit().asXmlNode(doc)); try { BodyImpl body = new BodyImpl(elem); List<? extends StructuralUnit> sus = body.getStructuralUnits(); assertEquals(new Integer(3), new Integer(sus.size())); assertEquals(createEmptyGroup(), sus.get(0)); assertEquals(createDefaultTransUnit(), sus.get(1)); assertEquals(createDefaultBinUnit(), sus.get(2)); } catch (ConstraintViolationException e) { fail("Did not expect ConstraintViolationException"); } elem.appendChild(createDefaultSource().asXmlNode(doc)); try { new BodyImpl(elem); fail("Expected ConstraintViolationException"); } catch (ConstraintViolationException e) { } }