@Test
public void testCreateErrorElement() throws Exception {

    ErrorMessage errorMessage = new ErrorMessage();
    ArrayList<IEbmsError> errors = new ArrayList<>();
    EbmsError ebmsError = new EbmsError();
    // Set required attributes
    ebmsError.setSeverity(IEbmsError.Severity.failure);
    ebmsError.setErrorCode("some_error_code");
    errors.add(ebmsError);
    errorMessage.setErrors(errors);
    OMElement esElement =
            ErrorSignalElement.createElement(headerBlock, errorMessage);
    EbmsError newEbmsError = new EbmsError();
    // Set required attributes
    newEbmsError.setSeverity(IEbmsError.Severity.failure);
    newEbmsError.setErrorCode("some_new_error_code");
    // Set optonal attributes
    newEbmsError.setCategory("some_category");
    newEbmsError.setOrigin("some_error_origin");
    newEbmsError.setMessage("some_message");
    newEbmsError.setRefToMessageInError("ref_to_some_message");
    newEbmsError.setErrorDetail("some_error_detail");
    Description description = new Description("some_text", "en-CA");
    newEbmsError.setDescription(description);
    OMElement eElement =
            ErrorSignalElement.createErrorElement(esElement, newEbmsError);
    System.out.println("eElement: " + eElement);
    assertEquals(ERROR_ELEMENT_NAME, eElement.getQName());
    assertEquals(IEbmsError.Severity.failure.toString(),
            eElement.getAttributeValue(SEVERITY_ATTR_NAME));
    assertEquals("some_new_error_code",
            eElement.getAttributeValue(ERROR_CODE_ATTR_NAME));
    assertEquals("some_category",
            eElement.getAttributeValue(CATEGORY_ATTR_NAME));
    assertEquals("some_error_origin",
            eElement.getAttributeValue(ORIGIN_ATTR_NAME));
    assertEquals("some_message",
            eElement.getAttributeValue(SHORT_DESCR_ATTR_NAME));
    assertEquals("ref_to_some_message",
            eElement.getAttributeValue(REF_TO_ATTR_NAME));
    OMElement errDetailElement = eElement.getFirstElement();
    assertEquals(Q_ERROR_DETAIL, errDetailElement.getQName());
    assertEquals("some_error_detail", errDetailElement.getText());
    OMElement dElement = DescriptionElement.getElement(eElement);
    assertEquals(DESCRIPTION_ELEMENT_NAME, dElement.getQName());
    assertEquals("some_text", dElement.getText());
    assertEquals("en-CA",
            dElement.getAttributeValue(LANG_ATTR_NAME));
}