add a test for bug 31976

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bernhard Messer 2004-11-21 22:33:54 +00:00
parent b77b25d52b
commit f2b8cfbde7

View File

@ -17,6 +17,10 @@ package org.apache.lucene.index;
*/
import junit.framework.TestCase;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.store.RAMDirectory;
import java.io.IOException;
@ -200,4 +204,21 @@ public class TestTermVectorsWriter extends TestCase {
}
}
public void testBadSegment() {
try {
dir = new RAMDirectory();
IndexWriter ir = new IndexWriter(dir, new StandardAnalyzer(), true);
Document document = new Document();
document.add(new Field("tvtest", "", Field.Store.NO, Field.Index.TOKENIZED,
Field.TermVector.YES)); // throws exception, works with Field.TermVector.NO
ir.addDocument(document);
ir.close();
} catch (Exception e) {
e.printStackTrace();
assertTrue(false);
}
}
}