ErrorSignalElement { public static ErrorMessage readElement(final OMElement sigElement) { final ErrorMessage errData = new ErrorMessage(); MessageInfoElement.readElement(MessageInfoElement.getElement(sigElement), errData); final Iterator<OMElement> it = sigElement.getChildrenWithName(Q_ELEMENT_NAME); while (it.hasNext()) errData.addError(readErrorElement(it.next())); return errData; }  static OMElement createElement(final OMElement messaging, final IErrorMessage errorMU); static ErrorMessage readElement(final OMElement sigElement); static Iterator<OMElement> getElements(final SOAPHeaderBlock messaging); static final QName Q_ELEMENT_NAME; }
@Test public void testReadElement() throws Exception { ErrorMessage errorMessage = new ErrorMessage(); ArrayList<IEbmsError> errors = new ArrayList<>(); EbmsError ebmsError = new EbmsError(); ebmsError.setCategory(""); ebmsError.setSeverity(IEbmsError.Severity.failure); ebmsError.setErrorCode("some_error_code"); errors.add(ebmsError); errorMessage.setErrors(errors); OMElement esElement = ErrorSignalElement.createElement(headerBlock, errorMessage); errorMessage = ErrorSignalElement.readElement(esElement); assertNotNull(errorMessage); Iterator<IEbmsError> it = errorMessage.getErrors().iterator(); assertTrue(it.hasNext()); ebmsError = (EbmsError)it.next(); assertEquals("some_error_code", ebmsError.getErrorCode()); assertEquals(IEbmsError.Severity.failure, ebmsError.getSeverity()); }