Remove test dependency on Java default exception message (#12724)

This commit is contained in:
Vigya Sharma 2023-10-27 15:09:44 -07:00 committed by GitHub
parent c3f48587fd
commit f5776c8844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,19 +157,9 @@ public class TestCoreParser extends LuceneTestCase {
}
public void testSpanNearQueryWithoutSlopXML() throws Exception {
Exception expectedException = new NumberFormatException("For input string: \"\"");
try {
Query q = parse("SpanNearQueryWithoutSlop.xml");
fail("got query " + q + " instead of expected exception " + expectedException);
} catch (Exception e) {
assertEquals(expectedException.toString(), e.toString());
}
try {
SpanQuery sq = parseAsSpan("SpanNearQueryWithoutSlop.xml");
fail("got span query " + sq + " instead of expected exception " + expectedException);
} catch (Exception e) {
assertEquals(expectedException.toString(), e.toString());
}
// expected NumberFormatException from empty "slop" string
assertThrows(NumberFormatException.class, () -> parse("SpanNearQueryWithoutSlop.xml"));
assertThrows(NumberFormatException.class, () -> parseAsSpan("SpanNearQueryWithoutSlop.xml"));
}
public void testConstantScoreQueryXML() throws Exception {