}
computeAndCheck();
}
private void computeAndCheck() throws GarbageException {
graph.compute(new DataRecordIdentifier(1));
final Set<DataRecordIdentifier> attachedSet = graph
.getAttachedToRootSet();
assertEquals("bad number of attached", attachedList.length,
attachedSet.size());
for (long attachedExpected : attachedList) {
if (!attachedSet
.contains(new DataRecordIdentifier(attachedExpected))) {// NOPMD
fail("must contains " + attachedExpected);
}
}
assertEquals("bad number of detached set", 2,
graph.numberOfDetachedSet());
Set<DataRecordIdentifier> detachedSet = graph
.getDetachedToRootSet(new DataRecordIdentifier(detachedList1[0]));
for (long detached : detachedList1) {
final Set<DataRecordIdentifier> detachedSet2 = graph
.getDetachedToRootSet(new DataRecordIdentifier(detached));// NOPMD
assertSame("bad set", detachedSet, detachedSet2);
}
detachedSet = graph.getDetachedToRootSet(new DataRecordIdentifier(
detachedList2[0]));
for (long detached : detachedList2) {
final Set<DataRecordIdentifier> detachedSet2 = graph
.getDetachedToRootSet(new DataRecordIdentifier(detached));// NOPMD
assertSame("bad set", detachedSet, detachedSet2);
}
}