ReceiptElement { public static Iterator<OMElement> getElements(final SOAPHeaderBlock messaging) { final Iterator<?> signals = SignalMessageElement.getElements(messaging); final ArrayList<OMElement> receipts = new ArrayList<>(); while(signals.hasNext()) { final OMElement signal = (OMElement) signals.next(); if (signal.getFirstChildWithName(Q_ELEMENT_NAME) != null) receipts.add(signal); } return receipts.iterator(); }  static OMElement createElement(final OMElement messaging, final IReceipt receipt); static Receipt readElement(final OMElement sigElement); static Iterator<OMElement> getElements(final SOAPHeaderBlock messaging); static final QName Q_ELEMENT_NAME; }
@Test public void testGetElements() throws Exception { Receipt receipt = new Receipt(); OMElement receiptChildElement = soapEnvelope.getOMFactory().createOMElement(RECEIPT_CHILD_ELEMENT_NAME); ArrayList<OMElement> content = new ArrayList<>(); content.add(receiptChildElement); receipt.setContent(content); ReceiptElement.createElement(headerBlock, receipt); Iterator<OMElement> it = ReceiptElement.getElements(headerBlock); assertTrue(it.hasNext()); assertEquals(SIGNAL_MESSAGE_ELEMENT_NAME, it.next().getQName()); }