Apache Solr open-source search software
add test for runtime exceptions
Daniel Naber8f99bfef890b
diff --git a/src/test/org/apache/lucene/document/TestDocument.java b/src/test/org/apache/lucene/document/TestDocument.javaindex 75c6a64911e..37ad47da0fd 100644--- a/src/test/org/apache/lucene/document/TestDocument.java+++ b/src/test/org/apache/lucene/document/TestDocument.java@@ -70,6 +70,25 @@ public class TestDocument extends TestCaseassertEquals(0, doc.fields.size());}+ public void testConstructorExceptions()+ {+ new Field("name", "value", Field.Store.YES, Field.Index.NO); // okay+ new Field("name", "value", Field.Store.NO, Field.Index.UN_TOKENIZED); // okay+ try {+ new Field("name", "value", Field.Store.NO, Field.Index.NO);+ fail();+ } catch(IllegalArgumentException e) {+ // expected exception+ }+ new Field("name", "value", Field.Store.YES, Field.Index.NO, Field.TermVector.NO); // okay+ try {+ new Field("name", "value", Field.Store.YES, Field.Index.NO, Field.TermVector.YES);+ fail();+ } catch(IllegalArgumentException e) {+ // expected exception+ }+ }+/*** Tests {@link Document#getValues(String)} method for a brand new Document* that has not been indexed yet.