Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

improve test

Robert Muird73ff28707c8
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
index e81b5052629..f0633ece7d0 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
@@ -35,6 +35,7 @@ import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Analyzer.TokenStreamComponents;
import org.apache.lucene.document.BinaryDocValuesField;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -1502,6 +1503,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
String value = null;
doc.add(new StoredField("foo", value));
iw.addDocument(doc);
+ fail("didn't get expected exception");
} catch (IllegalArgumentException expected) {}
iw.shutdown();
// make sure we see our good doc
@@ -1525,6 +1527,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
// set to null value
theField.setStringValue(null);
iw.addDocument(doc);
+ fail("didn't get expected exception");
} catch (IllegalArgumentException expected) {}
iw.shutdown();
// make sure we see our good doc
@@ -1549,6 +1552,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
Field theField = new StoredField("foo", v);
doc.add(theField);
iw.addDocument(doc);
+ fail("didn't get expected exception");
} catch (NullPointerException expected) {}
iw.shutdown();
// make sure we see our good doc
@@ -1573,6 +1577,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
byte v[] = null;
theField.setBytesValue(v);
iw.addDocument(doc);
+ fail("didn't get expected exception");
} catch (NullPointerException expected) {}
iw.shutdown();
// make sure we see our good doc
@@ -1597,6 +1602,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
Field theField = new StoredField("foo", v);
doc.add(theField);
iw.addDocument(doc);
+ fail("didn't get expected exception");
} catch (IllegalArgumentException expected) {}
iw.shutdown();
// make sure we see our good doc
@@ -1621,6 +1627,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
BytesRef v = null;
theField.setBytesValue(v);
iw.addDocument(doc);
+ fail("didn't get expected exception");
} catch (IllegalArgumentException expected) {}
iw.shutdown();
// make sure we see our good doc