Github user gerlowskija commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/464#discussion_r227022552
--- Diff: solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
---
@@ -1214,29 +1208,23 @@ public void testPayloadScoreQuery() throws
Exception {
// I don't see a precedent to test query inequality in here, so doing
a `try`
// There was a bug with PayloadScoreQuery's .equals() method that said
two queries were equal with different includeSpanScore settings
- try {
- assertQueryEquals
- ("payload_score"
- , "{!payload_score f=foo_dpf v=query func=min
includeSpanScore=false}"
- , "{!payload_score f=foo_dpf v=query func=min
includeSpanScore=true}"
- );
- fail("queries should not have been equal");
- } catch(AssertionFailedError e) {
- assertTrue("queries were not equal, as expected", true);
- }
+ expectThrows(AssertionFailedError.class, "queries were not equal, as
expected",
+ () -> assertQueryEquals
+ ("payload_score"
+ , "{!payload_score f=foo_dpf v=query func=min
includeSpanScore=false}"
+ , "{!payload_score f=foo_dpf v=query func=min
includeSpanScore=true}"
+ )
+ );
}
public void testPayloadCheckQuery() throws Exception {
- try {
- assertQueryEquals
- ("payload_check"
- , "{!payload_check f=foo_dpf payloads=2}one"
- , "{!payload_check f=foo_dpf payloads=2}two"
- );
- fail("queries should not have been equal");
- } catch(AssertionFailedError e) {
- assertTrue("queries were not equal, as expected", true);
- }
+ expectThrows(AssertionFailedError.class, "queries were not equal, as
expected",
--- End diff --
[-1] I think this exception message here is backwards. This assertion
fails if the queries _were_ equal, but the message indicates that the problem
is that they were !=. Using the message from the original `fail()` invocation
would probably work better here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]