indexWriterControl.replay();
listenerControl.replay();
//Indexer
DefaultDirectoryIndexer indexer = new DefaultDirectoryIndexer(indexFactory);
indexer.registerDocumentHandler(new ExtensionDocumentMatching("foo"),
new TextDocumentHandler());
indexer.addListener(listener);
File baseDirectory = getBaseDirectoryToIndex();
indexer.index(baseDirectory.getAbsolutePath());