Apache Lucene open-source search software
tests: ignore expected exceptions
Yonik Seeley90d792dd1d13
diff --git a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.javaindex 28667b5b8d1..4dbacc6412d 100644--- a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java+++ b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java@@ -73,12 +73,14 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {"fl", "id," + fieldName, "q", "*:*", "rows", "1000","fq", "{!field f="+fieldName+"}Intersectssss"), 400);+ ignoreException("NonexistentShape");try {assertU(adoc("id", "-1", fieldName, "NonexistentShape"));fail();} catch (SolrException e) {assertEquals(400, e.code());}+ unIgnoreException("NonexistentShape");}private void setupDocs() {diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.javaindex d5b558be22c..2284e89d532 100755--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java@@ -713,23 +713,29 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {/** Makes sure a query throws a SolrException with the listed response code */public static void assertQEx(String message, SolrQueryRequest req, int code ) {try {+ ignoreException(".");h.query(req);fail( message );} catch (SolrException sex) {assertEquals( code, sex.code() );} catch (Exception e2) {throw new RuntimeException("Exception during query", e2);+ } finally {+ unIgnoreException(".");}}public static void assertQEx(String message, SolrQueryRequest req, SolrException.ErrorCode code ) {try {+ ignoreException(".");h.query(req);fail( message );} catch (SolrException e) {assertEquals( code.code, e.code() );} catch (Exception e2) {throw new RuntimeException("Exception during query", e2);+ } finally {+ unIgnoreException(".");}}