SOLR-1730: check the cause exception

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1213704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Grant Ingersoll 2011-12-13 14:21:30 +00:00
parent 4da73b1f9e
commit 7c0069cbb7
1 changed files with 8 additions and 3 deletions

View File

@ -33,9 +33,14 @@ public class BadComponentTest extends SolrTestCaseJ4{
System.setProperty("elevate.file", "foo.xml");
initCore("solrconfig-elevate.xml", "schema12.xml");
assertTrue(false);
} catch (Throwable e) {
log.error("Exception", e);
assertTrue(true);
} catch (RuntimeException e) {
//TODO: better way of checking this?
if (e.getCause() instanceof SolrException && e.getCause().getCause().getMessage().equals("Error initializing QueryElevationComponent.")){
log.error("Exception", e);
assertTrue(true);
} else {
assertTrue(false);
}
} finally {
System.clearProperty("elevate.file");
}