Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-6956: make sure specific test method fails, instead of relying on 'unhandled exc in thread' from test framework

Michael McCandless3a29f0ebe174
diff --git a/lucene/sandbox/src/test/org/apache/lucene/util/BaseGeoPointTestCase.java b/lucene/sandbox/src/test/org/apache/lucene/util/BaseGeoPointTestCase.java
index 2bee1ed79b2..9c25bbc2477 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/util/BaseGeoPointTestCase.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/util/BaseGeoPointTestCase.java
@@ -496,7 +496,7 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
private static abstract class VerifyHits {
- public void test(boolean small, IndexSearcher s, NumericDocValues docIDToID, Set<Integer> deleted, Query query, double[] lats, double[] lons) throws Exception {
+ public void test(AtomicBoolean failed, boolean small, IndexSearcher s, NumericDocValues docIDToID, Set<Integer> deleted, Query query, double[] lats, double[] lons) throws Exception {
int maxDoc = s.getIndexReader().maxDoc();
final FixedBitSet hits = new FixedBitSet(maxDoc);
s.search(query, new SimpleCollector() {
@@ -550,6 +550,7 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
}
if (fail) {
+ failed.set(true);
fail("some hits were wrong");
}
}
@@ -754,7 +755,7 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
System.out.println(" query=" + query);
}
- verifyHits.test(small, s, docIDToID, deleted, query, lats, lons);
+ verifyHits.test(failed, small, s, docIDToID, deleted, query, lats, lons);
}
}
}
@@ -768,6 +769,7 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
thread.join();
}
IOUtils.close(r, dir);
+ assertFalse(failed.get());
}
protected Directory noVirusChecker(Directory dir) {