mirror of https://github.com/apache/lucene.git
add tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1439939 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2212440b3b
commit
09930c4c64
|
@ -1283,4 +1283,45 @@ public abstract class BaseDocValuesFormatTestCase extends LuceneTestCase {
|
|||
public void testSortedVariableLengthVsStoredFields() throws Exception {
|
||||
doTestSortedVsStoredFields(1, 10);
|
||||
}
|
||||
|
||||
public void testIllegalTypeChange() throws Exception {
|
||||
Directory dir = newDirectory();
|
||||
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
|
||||
IndexWriter writer = new IndexWriter(dir, conf);
|
||||
Document doc = new Document();
|
||||
doc.add(new NumericDocValuesField("dv", 0L));
|
||||
writer.addDocument(doc);
|
||||
doc = new Document();
|
||||
doc.add(new SortedDocValuesField("dv", new BytesRef("foo")));
|
||||
try {
|
||||
writer.addDocument(doc);
|
||||
fail("did not hit exception");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// expected
|
||||
}
|
||||
writer.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
public void testIllegalTypeChangeAcrossSegments() throws Exception {
|
||||
Directory dir = newDirectory();
|
||||
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
|
||||
IndexWriter writer = new IndexWriter(dir, conf);
|
||||
Document doc = new Document();
|
||||
doc.add(new NumericDocValuesField("dv", 0L));
|
||||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
|
||||
writer = new IndexWriter(dir, conf);
|
||||
doc = new Document();
|
||||
doc.add(new SortedDocValuesField("dv", new BytesRef("foo")));
|
||||
try {
|
||||
writer.addDocument(doc);
|
||||
fail("did not hit exception");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// expected
|
||||
}
|
||||
writer.close();
|
||||
dir.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue