I've moved the test to namenode package in order to access the blockManager instance from Namesystem.
However the size of recentInvalidateSets equals to 0. The content of this collection is updated by BlockManager.processReport and by the time the test's accessing it NN's blockreport is suppose to be complete. Which means that there might be a problem with DataNode.reportDiff() or else.
As for getReplica() call: I agree that a replica's reference shouldn't be exposed outside of FSDataset.
However, at the moment there's no alternative. Shall it be fixed separately?