tests: ignore expected exceptions

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1502006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2013-07-10 21:19:26 +00:00
parent 884ed33b39
commit 90d792dd1d
2 changed files with 8 additions and 0 deletions

View File

@ -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() {

View File

@ -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(".");
}
}