if(r instanceof ParentAwareRecord) {
ParentAwareRecord pr = (ParentAwareRecord)r;
assertEquals(parent, pr.getParentRecord());
}
if(r instanceof RecordContainer) {
RecordContainer rc = (RecordContainer)r;
Record[] children = rc.getChildRecords();
for(int i=0; i<children.length; i++) {
ensureParentAware(children[i], rc);
}
}