PartPropertiesElement { public static OMElement createElement(final OMElement piElement, final Collection<IProperty> properties) { if (Utils.isNullOrEmpty(properties)) return null; final OMFactory f = piElement.getOMFactory(); final OMElement partProps = f.createOMElement(Q_ELEMENT_NAME, piElement); for(final IProperty p : properties) PropertyElement.createElement(partProps, p); return partProps; }  static OMElement createElement(final OMElement piElement, final Collection<IProperty> properties); static OMElement getElement(final OMElement piElement); static Collection<IProperty> readElement(final OMElement ppElement); static final QName Q_ELEMENT_NAME; }
@Test public void testCreateElement() throws Exception { ArrayList<IProperty> properties = new ArrayList<>(); properties.add(new Property("some_property01", "some_value01", "some_type01")); properties.add(new Property("some_property02", "some_value02", "some_type02")); OMElement mpElement = PartPropertiesElement.createElement(createParent(), properties); assertNotNull(mpElement); assertEquals(Q_ELEMENT_NAME, mpElement.getQName()); Iterator it = mpElement.getChildrenWithName(Q_PROP_EL_NAME); assertTrue(it.hasNext()); it.next(); assertTrue(it.hasNext()); it.next(); assertFalse(it.hasNext()); }