these tests should really be using...
SolrException e = expectThrows(() -> {...});
...and ideally we should be making assertions about the exception message
as well (ie: does it say what we expect it to say? does it give the user
the context of the failure -- ie: containing the "non_numeric_value" so
they know what they did wrong?
: private void validateCommonQueryParameters() throws Exception {
: ignoreException("parameter cannot be negative");
: +
: + try {
: + SolrQuery query = new SolrQuery();
: + query.setParam("start", "non_numeric_value").setQuery("*");
: + QueryResponse resp = query(query);
: + fail("Expected the last query to fail, but got response: " + resp);
: + } catch (SolrException e) {
: + assertEquals(ErrorCode.BAD_REQUEST.code, e.code());
: + }
: +
: try {
: SolrQuery query = new SolrQuery();
: query.setStart(-1).setQuery("*");
: @@ -1228,6 +1238,15 @@ public class TestDistributedSearch extends
BaseDistributedSearchTestCase {
: } catch (SolrException e) {
: assertEquals(ErrorCode.BAD_REQUEST.code, e.code());
: }
: +
: + try {
: + SolrQuery query = new SolrQuery();
: + query.setParam("rows", "non_numeric_value").setQuery("*");
: + QueryResponse resp = query(query);
: + fail("Expected the last query to fail, but got response: " + resp);
: + } catch (SolrException e) {
: + assertEquals(ErrorCode.BAD_REQUEST.code, e.code());
: + }
: resetExceptionIgnores();
: }
: }
:
:
-Hoss
http://www.lucidworks.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]