setUserContext("1000019");
// a payment term line is not deletable, but for this test it should be done anyway
// force this by being admin
OBContext.getOBContext().setInAdministratorMode(true);
final ImportResult ir = DataImportService.getInstance().importDataFromXML(
OBDal.getInstance().get(Client.class, "1000001"),
OBDal.getInstance().get(Organization.class, "1000001"), xml);
if (ir.getException() != null) {
ir.getException().printStackTrace(System.err);
fail(ir.getException().getMessage());
}
assertEquals(0, ir.getInsertedObjects().size());
// name of paymentterm has changed
// overduepaymentrule of paymenttermline is set back to 1
assertEquals(2, ir.getUpdatedObjects().size());
for (final Object o : ir.getUpdatedObjects()) {
assertTrue(o instanceof PaymentTerm || o instanceof PaymentTermLine);
}
}