@Test
public void testReadErrorElement() throws Exception {

    ErrorMessage errorMessage = new ErrorMessage();
    ArrayList<IEbmsError> errors = new ArrayList<>();
    EbmsError ebmsError = new EbmsError();
    // Required attributes
    ebmsError.setSeverity(IEbmsError.Severity.failure);
    ebmsError.setErrorCode("some_error_code");
    // Optional attributes
    ebmsError.setCategory("some_category");
    ebmsError.setOrigin("some_error_origin");
    ebmsError.setMessage("some_message");
    ebmsError.setRefToMessageInError("ref_to_some_message");
    ebmsError.setErrorDetail("some_error_detail");
    Description description = new Description("some_text", "en-CA");
    ebmsError.setDescription(description);
    errors.add(ebmsError);
    errorMessage.setErrors(errors);
    OMElement esElement =
            ErrorSignalElement.createElement(headerBlock, errorMessage);
    OMElement eElement =
            (OMElement) esElement.getChildrenWithName(ERROR_ELEMENT_NAME).next();
    ebmsError = ErrorSignalElement.readErrorElement(eElement);
    assertEquals(IEbmsError.Severity.failure, ebmsError.getSeverity());
    assertEquals("some_error_code", ebmsError.getErrorCode());
    assertEquals("some_category", ebmsError.getCategory());
    assertEquals("some_error_origin", ebmsError.getOrigin());
    assertEquals("some_message", ebmsError.getMessage());
    assertEquals("ref_to_some_message", ebmsError.getRefToMessageInError());
    assertEquals("some_error_detail", ebmsError.getErrorDetail());
    assertEquals("some_text", ebmsError.getDescription().getText());
    assertEquals("en-CA", ebmsError.getDescription().getLanguage());
}