}
@Test(timeout=20000)
public void testAsyncReport() throws Exception {
FSDataset mock = Mockito.mock(FSDataset.class);
AsyncBlockReport abr = new FSDataset.AsyncBlockReport(mock);
abr.start();
try {
for (int i = 0; i < 3; i++) {
HashMap<Block, File> mockResult = new HashMap<Block, File>();
Mockito.doReturn(mockResult).when(mock).roughBlockScan();
assertFalse(abr.isReady());
abr.request();
while (!abr.isReady()) {
Thread.sleep(10);
}
assertSame(mockResult, abr.getAndReset());
assertFalse(abr.isReady());
}
} finally {
abr.shutdown();
}
}