mirror of
https://github.com/apache/lucene.git
synced 2025-03-04 15:29:28 +00:00
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:
parent
b77b25d52b
commit
f2b8cfbde7
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user