}
public void testReuseAcrossWriters() throws IOException {
Directory dir = new MockRAMDirectory();
SnapshotDeletionPolicy dp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
IndexWriter writer = new IndexWriter(dir, true,new StandardAnalyzer(), dp);
// Force frequent commits
writer.setMaxBufferedDocs(2);
Document doc = new Document();
doc.add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
for(int i=0;i<7;i++)
writer.addDocument(doc);
IndexCommit cp = (IndexCommit) dp.snapshot();
copyFiles(dir, cp);
writer.close();
copyFiles(dir, cp);
writer = new IndexWriter(dir, true, new StandardAnalyzer(), dp);
copyFiles(dir, cp);
for(int i=0;i<7;i++)
writer.addDocument(doc);
copyFiles(dir, cp);
writer.close();
copyFiles(dir, cp);
dp.release();
writer = new IndexWriter(dir, true, new StandardAnalyzer(), dp);
writer.close();
try {
copyFiles(dir, cp);
fail("did not hit expected IOException");