}
@Test
public void testScanSingleMessage() throws Exception {
StubScanCallback callback = new StubScanCallback();
ScanRequest request = new ScanRequest(topic, 1, callback, null);
stubPersistenceManager.failure = true;
cacheBasedPersistenceManager.scanSingleMessage(request);
assertTrue(callback.isFailed());
assertTrue(0 == cacheBasedPersistenceManager.cache.size());
stubPersistenceManager.failure = false;
cacheBasedPersistenceManager.scanSingleMessage(request);
assertTrue(myConf.readAheadCount == cacheBasedPersistenceManager.cache.size());
persistMessage(messages.get(0));
assertTrue(callback.isSuccess());
}