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:
Robert Muir 2010-09-24 18:25:09 +00:00
parent b20a4b7097
commit f8c0293d85
3 changed files with 11 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {