SOLR-11263: add test for payload func with undefined field

Payload func with undefined used to throw NPE. In SOLR-11610, this
was fixed to return proper error but there are no tests to verify
changed the behavior.
This add simple test to verify error code and error message
This commit is contained in:
Munendra S N 2019-07-10 10:17:55 +05:30
parent 860e0be537
commit 0752c07c1c
1 changed files with 4 additions and 0 deletions

View File

@ -470,6 +470,10 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
);
// this should pass
assertQ(req("q", "*:*","defType","edismax", "boost","recip(1, 2, 3, 4)"));
// for undefined field NPE shouldn't be thrown
assertQEx("Should Fail as the field is undefined", "undefined field a",
req("q", "*:*", "fl", "x:payload(a,b)"), SolrException.ErrorCode.BAD_REQUEST);
}
@Test