PropertyElement { public static Property readElement(final OMElement propElement) { if (propElement == null) return null; final String name = propElement.getAttributeValue(new QName(LN_ATTR_NAME)); final String value = propElement.getText(); final String type = propElement.getAttributeValue(new QName(LN_ATTR_TYPE)); return new Property(name, value, type); }  static OMElement createElement(final OMElement parent, final IProperty data); static Iterator<OMElement> getElements(final OMElement parent); static Property readElement(final OMElement propElement); static final QName Q_ELEMENT_NAME; static final String LN_ATTR_NAME; static final String LN_ATTR_TYPE; }
@Test public void testReadElementWithType() throws Exception { String pName = "reference_number"; String pType = "CrossReferenceID"; String pValue = "XREF_4828"; Property prop = PropertyElement.readElement(createXML( "<eb3:Property name=\"" + pName + "\" type=\"" + pType +"\"" + " xmlns:eb3=\"http: pValue + "</eb3:Property>" )); assertNotNull(prop); assertEquals(pName, prop.getName()); assertEquals(pType, prop.getType()); assertEquals(pValue, prop.getValue()); }
@Test public void testReadElementNoType() throws Exception { String pName = "reference_number"; String pValue = "XREF_4828"; Property prop = PropertyElement.readElement(createXML( "<eb3:Property name=\"" + pName + "\"" + " xmlns:eb3=\"http: pValue + "</eb3:Property>" )); assertNotNull(prop); assertEquals(pName, prop.getName()); assertNull(prop.getType()); assertEquals(pValue, prop.getValue()); }