@Test
public void testComvertBackAndForth ()
{

  for (final String sFilename : MockUBL21TestDocuments.getUBL21TestDocuments (EUBL21DocumentType.INVOICE))
  {
    LOGGER.info (sFilename);
    // Read
    final Document aDoc = DOMReader.readXMLDOM (new ClassPathResource (sFilename),
                                                new DOMReaderSettings ().setSchema (EUBL21DocumentType.INVOICE.getSchema ()));
    assertNotNull (sFilename, aDoc);
    final InvoiceType aUBLObject = UBL21Reader.invoice ().read (aDoc);
    assertNotNull (sFilename, aUBLObject);
    // Convert Invoice to CreditNote
    final CreditNoteType aCreditNote = new CreditNoteType ();
    UBL21InvoiceHelper.cloneInvoiceToCreditNote (aUBLObject, aCreditNote);
    // Validate CreditNote
    IErrorList aErrors = UBL21Validator.creditNote ().validate (aCreditNote);
    assertNotNull (sFilename, aErrors);
    assertFalse (sFilename, aErrors.containsAtLeastOneError ());
    // Convert CreditNote back to Invoice
    final InvoiceType aInvoice2 = new InvoiceType ();
    UBL21CreditNoteHelper.cloneCreditNoteToInvoice (aCreditNote, aInvoice2);
    // Validate Invoice again
    aErrors = UBL21Validator.invoice ().validate (aInvoice2);
    assertNotNull (sFilename, aErrors);
    assertFalse (sFilename, aErrors.containsAtLeastOneError ());
  }
}