mirror of https://github.com/apache/lucene.git
LUCENE-1840: QueryUtils should check that equals() properly handles null
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1001006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b20a4b7097
commit
f8c0293d85
|
@ -145,6 +145,10 @@ public class CustomScoreQuery extends Query {
|
|||
/** Returns true if <code>o</code> is equal to this. */
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (!super.equals(o))
|
||||
return false;
|
||||
if (getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -185,6 +185,10 @@ public class ValueSourceQuery extends Query {
|
|||
/** Returns true if <code>o</code> is equal to this. */
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (!super.equals(o))
|
||||
return false;
|
||||
if (getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ public class QueryUtils {
|
|||
};
|
||||
whacky.setBoost(q.getBoost());
|
||||
checkUnequal(q, whacky);
|
||||
|
||||
// null test
|
||||
Assert.assertFalse(q.equals(null));
|
||||
}
|
||||
|
||||
public static void checkEqual(Query q1, Query q2) {
|
||||
|
|
Loading…
Reference in New Issue