NodePropBundle orphaned = new NodePropBundle(orphanedId);
// set non-existent parent node id
orphaned.setParentId(new NodeId(1, 0));
MockPersistenceManager pm = new MockPersistenceManager(Arrays.asList(lostAndFound, orphaned));
ConsistencyCheckerImpl checker = new ConsistencyCheckerImpl(pm, null, lostAndFoundId.toString(),
master.createUpdateChannel("default"));
// set up cluster event update listener
final TestUpdateEventListener listener = new TestUpdateEventListener();
final UpdateEventChannel slaveEventChannel = slave.createUpdateChannel("default");
slaveEventChannel.setListener(listener);
checker.check(null, false);
Set<ReportItem> reportItems = checker.getReport().getItems();
assertEquals(1, reportItems.size());
ReportItem reportItem = reportItems.iterator().next();
assertEquals(ReportItem.Type.ORPHANED, reportItem.getType());
assertEquals(orphanedId.toString(), reportItem.getNodeId());
checker.repair();
// orphan should have been added to lost+found
lostAndFound = pm.loadBundle(lostAndFoundId);
assertEquals(1, lostAndFound.getChildNodeEntries().size());
assertEquals(orphanedId, lostAndFound.getChildNodeEntries().get(0).getId());