@Test
public void writeDeliveryReportRequestWithCreateFinalMessageErrorCode() throws Exception {

    DeliveryReportRequest request = new DeliveryReportRequest();
    request.setAccount(new Account("customer1", "test1"));
    request.setReferenceId("TESTREF");
    request.setStatus(new DeliveryStatus(5, "EXPIRED"));
    request.setTicketId("000:20090118002220948:000");
    // new properties in version 1.2
    request.setCreateDate(new DateTime(2010,5,30,9,30,10,0, DateTimeZone.UTC));
    request.setFinalDate(new DateTime(2010,5,30,9,30,15,314, DateTimeZone.UTC));
    request.setMessageErrorCode(new Integer(102));
    StringWriter sw = new StringWriter();
    SxmpWriter.write(sw, request);
    logger.debug(sw.toString());
    StringBuilder expectedXML = new StringBuilder(200)
        .append("<?xml version=\"1.0\"?>\n")
        .append("<operation type=\"deliveryReport\">\n")
        .append(" <account username=\"customer1\" password=\"test1\"/>\n")
        .append(" <deliveryReportRequest referenceId=\"TESTREF\">\n")
        .append("   <status code=\"5\" message=\"EXPIRED\"/>\n")
        .append("   <ticketId>000:20090118002220948:000</ticketId>\n")
        .append("   <messageError code=\"102\"/>\n")
        .append("   <createDate>2010-05-30T09:30:10.000Z</createDate>\n")
        .append("   <finalDate>2010-05-30T09:30:15.314Z</finalDate>\n")
        .append(" </deliveryReportRequest>\n")
        .append("</operation>\n")
        .append("");
    // compare to actual correct submit response
    XMLUnit.setIgnoreWhitespace(true);
    Diff myDiff = new Diff(expectedXML.toString(), sw.toString());
    DetailedDiff myDetailedDiff = new DetailedDiff(myDiff);
    Assert.assertTrue("XML are similar " + myDetailedDiff, myDetailedDiff.similar());
}