XImpl extends InlineBaseImpl implements X { public Clone getClone() { return (Clone) getXliffAttribute(Clone.NAME); } XImpl(Id id);  XImpl(org.w3c.dom.Element element); @Override List<? extends Node> getChildren(); Clone getClone(); CtypePh getCtype(); String getPlainText(); void setClone(Clone clone); void setCtype(CtypePh ctype);  }
@Test public void testXImplIdListOfQextendsCodeFragment() { XImpl x = createDefaultX(); assertEquals(new IdImpl("1"), x.getId()); assertEquals(new CloneImpl(Clone.Value.YES), x.getClone()); }
@Test public void testXImplElement() { Document doc = Utils.createDocument(); Element elem = doc.createElementNS(XLIFF_12_NAMESPACE, "x"); elem.setAttributeNS(null, "id", "1"); elem.setAttributeNS(null, "ctype", "x-abc"); try { XImpl x = new XImpl(elem); assertEquals(new IdImpl("1"), x.getId()); assertEquals(new CloneImpl(Clone.Value.YES), x.getClone()); } catch (ConstraintViolationException e) { fail("Did not expect ConstraintViolationException"); } elem.setTextContent("abc"); try { new XImpl(elem); fail("Expected ConstraintViolationException"); } catch (ConstraintViolationException e) { elem.removeChild(elem.getFirstChild()); } elem.setAttributeNS(null, "ctype", "bold"); try { new XImpl(elem); fail("Expected ConstraintViolationException"); } catch (ConstraintViolationException e) { } elem.setAttributeNS(null, "ctype", "image"); try { new XImpl(elem); } catch (ConstraintViolationException e) { fail("Did not expect ConstraintViolationException"); } }