GramBooleanQuery { @Override public boolean equals(Object compareTo) { if (!(compareTo instanceof GramBooleanQuery)) { return false; } GramBooleanQuery that = (GramBooleanQuery) compareTo; if (this.operator != that.operator) { return false; } if (this.operator == QueryOp.ANY || this.operator == QueryOp.NONE) { return true; } if (this.operator == QueryOp.LEAF) { return this.leaf.equals(that.leaf); } if (!this.subQuerySet.equals(that.subQuerySet)) { return false; } return true; } GramBooleanQuery(QueryOp operator); static GramBooleanQuery deepCopy(GramBooleanQuery query); @Override int hashCode(); @Override boolean equals(Object compareTo); boolean isEmpty(); @Override String toString(); String getLuceneQueryString();  }
@Test public void testEmptySameOp() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); Assert.assertTrue(query1.equals(query2)); }
@Test public void testEmptyDifferentOp() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); Assert.assertFalse(query1.equals(query2)); }