QueryUtils { public static String conjoinSolrQueries(String q1, String q2){ if(StringUtils.isEmpty(q1)){ return q2; } if(StringUtils.isEmpty(q2)){ return q1; } return q1 + " AND " + q2 ; }  static String conjoinSolrQueries(String q1, String q2); static String buildConjunctiveClause(String fieldName,
                                              Collection<String> values); static String buildQuery(Collection<String> sourceTypes,
                                  Collection<String> types);  }
@Test public void testSolrQuery(){ String clause1 = "extractorRunIds:(x##0 OR x##1 OR x##2)"; String clause2 = "identity:(foo OR bar OR baz)"; String fullQuery = QueryUtils.conjoinSolrQueries(clause1, clause2); String ans = "extractorRunIds:(x##0 OR x##1 OR x##2) " + "AND identity:(foo OR bar OR baz)"; assertEquals(ans, fullQuery); }