ErrorSignalElement { public static OMElement createElement(final OMElement messaging, final IErrorMessage errorMU) { final OMElement signalmessage = SignalMessageElement.createElement(messaging); MessageInfoElement.createElement(signalmessage, errorMU); for(final IEbmsError error : errorMU.getErrors()) createErrorElement(signalmessage, error); return signalmessage; }  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 testCreateElement() throws Exception { ErrorMessage errorMessage = new ErrorMessage(); ArrayList<IEbmsError> errors = new ArrayList<>(); EbmsError ebmsError = new EbmsError(); ebmsError.setSeverity(IEbmsError.Severity.failure); ebmsError.setErrorCode("some_error_code"); errors.add(ebmsError); errorMessage.setErrors(errors); OMElement esElement = ErrorSignalElement.createElement(headerBlock, errorMessage); assertEquals(SIGNAL_MESSAGE_ELEMENT_NAME, esElement.getQName()); OMElement eElement = (OMElement)esElement.getChildrenWithName(ERROR_ELEMENT_NAME).next(); assertEquals(ERROR_ELEMENT_NAME, eElement.getQName()); assertEquals(IEbmsError.Severity.failure.toString(), eElement.getAttributeValue(SEVERITY_ATTR_NAME)); assertEquals("some_error_code", eElement.getAttributeValue(ERROR_CODE_ATTR_NAME)); }