DescriptionElement { public static Description readElement(final OMElement descrElement) { if (descrElement == null) return null; final String text = descrElement.getText(); final String language = descrElement.getAttributeValue(new QName(NS_URI_ATTR_LANG, LN_ATTR_LANG)); return new Description(text, language); }  static OMElement createElement(final OMElement parent, final IDescription data); static OMElement getElement(final OMElement parent); static Description readElement(final OMElement descrElement); static final QName Q_ELEMENT_NAME; static final String LN_ATTR_LANG; }
@Test public void testReadElementWithLang() { String text = "This is just a test"; String lang = "en-US"; Description descr = DescriptionElement.readElement(createXML( " <eb3:Description xml:lang=\"" + lang + "\"" + " xmlns:eb3=\"http: text + "</eb3:Description>")); assertNotNull(descr); assertEquals(text, descr.getText()); assertEquals(lang, descr.getLanguage()); }
@Test public void testReadElementNoLang() { String text = "This is just a test"; Description descr = DescriptionElement.readElement(createXML( " <eb3:Description" + " xmlns:eb3=\"http: text + "</eb3:Description>")); assertNotNull(descr); assertEquals(text, descr.getText()); assertNull(descr.getLanguage()); }