add test for when fixed dv is not really fixed length

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1370241 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-08-07 13:17:37 +00:00
parent 7ca42b800a
commit 1ff47b2c08
1 changed files with 17 additions and 0 deletions

View File

@ -1025,4 +1025,21 @@ public class TestDocValuesIndexing extends LuceneTestCase {
w.close(); w.close();
d.close(); d.close();
} }
public void testFixedLengthNotReallyFixed() throws IOException {
Directory d = newDirectory();
IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())));
Document doc = new Document();
doc.add(new DerefBytesDocValuesField("foo", new BytesRef("bar"), true));
w.addDocument(doc);
doc = new Document();
doc.add(new DerefBytesDocValuesField("foo", new BytesRef("bazz"), true));
try {
w.addDocument(doc);
} catch (IllegalArgumentException expected) {
// expected
}
w.close();
d.close();
}
} }