GramBooleanQuery { static GramBooleanQuery combine(GramBooleanQuery query, List<String> list) { return computeConjunction(query, listNode(list)); } 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 testSameAnd() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("abc"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("abc"))); Assert.assertEquals(query1, query2); Assert.assertEquals(query2, query1); }
@Test public void testSameOr() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("abcdef"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("abcdef"))); Assert.assertEquals(query1, query2); Assert.assertEquals(query2, query1); }
@Test public void testSameMultiple() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("abc"))); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("pqr"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("abc"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("pqr"))); Assert.assertEquals(query1, query2); Assert.assertEquals(query2, query1); }
@Test public void testSameDifferentOrder() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("abc", "pqr"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("pqr", "abc"))); Assert.assertEquals(query1, query2); Assert.assertEquals(query2, query1); }
@Test public void testSameDifferentOrder2() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("asdfg", "poiuy"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("poiuy", "asdfg"))); Assert.assertEquals(query1, query2); Assert.assertEquals(query2, query1); }
@Test public void testSameDifferentOrder3() { GramBooleanQuery query1 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); GramBooleanQuery query2 = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); query1 = GramBooleanQuery.combine(query1, (Arrays.asList("abcd", "qwer", "zxc"))); query2 = GramBooleanQuery.combine(query2, (Arrays.asList("zxc", "qwer", "abcd"))); Assert.assertEquals(query1, query2); Assert.assertEquals(query2, query1); }