StringBuffer msg = new StringBuffer();
for (int i = 0; i < size; i++) {
DeepEquality expected = (DeepEquality) rootList.get(i);
Object oid = rootOids.get(i);
Object persisted = pm.getObjectById(oid);
EqualityHelper equalityHelper = new EqualityHelper();
if (!expected.deepCompareFields(persisted, equalityHelper)) {
if (msg.length() > 0) {
msg.append("\n");
}
msg.append("Expected this instance:\n " +
expected + "\n" +
"Got persistent instance:" + "\n " +
persisted + "\n" +
"Detailed list of differences follows...\n");
msg.append(equalityHelper.getUnequalBuffer());
}
}
pm.currentTransaction().commit();
// fail test if at least one of the instances is not the expected one
if (msg.length() > 0) {