}
final public void testAddDocument() throws Exception {
SimpleAnalyzer analyzer = new SimpleAnalyzer();
MockControl indexFactoryControl = MockControl.createStrictControl(IndexFactory.class);
IndexFactory indexFactory = (IndexFactory)indexFactoryControl.getMock();
MockControl indexWriterControl = MockControl.createStrictControl(LuceneIndexWriter.class);
LuceneIndexWriter indexWriter = (LuceneIndexWriter)indexWriterControl.getMock();
MockControl documentCreatorControl = MockControl.createStrictControl(DocumentCreator.class);
DocumentCreator documentCreator = (DocumentCreator)documentCreatorControl.getMock();
//document
Document document = new Document();
document.add(new Field("field", "a sample", Field.Store.YES, Field.Index.TOKENIZED));
document.add(new Field("filter", "a sample filter", Field.Store.YES, Field.Index.TOKENIZED));
document.add(new Field("sort", "2", Field.Store.YES, Field.Index.UN_TOKENIZED));
indexFactory.getIndexWriter();
indexFactoryControl.setReturnValue(indexWriter, 1);
documentCreator.createDocument();
documentCreatorControl.setReturnValue(document);