public void testLeadingWildcardType() throws Exception {
   QueryParserWrapper qp = getParser(null);
   qp.setAllowLeadingWildcard(true);
   assertEquals(WildcardQuery.class, qp.parse("t*erm*").getClass());
   assertEquals(WildcardQuery.class, qp.parse("?term*").getClass());
   assertEquals(WildcardQuery.class, qp.parse("*term*").getClass());
 }
 public void assertWildcardQueryEquals(
     String query, boolean lowercase, String result, boolean allowLeadingWildcard)
     throws Exception {
   QueryParserWrapper qp = getParser(null);
   qp.setLowercaseExpandedTerms(lowercase);
   qp.setAllowLeadingWildcard(allowLeadingWildcard);
   Query q = qp.parse(query);
   String s = q.toString("field");
   if (!s.equals(result)) {
     fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /" + result + "/");
   }
 }
 public Query getQueryAllowLeadingWildcard(String query, Analyzer a) throws Exception {
   QueryParserWrapper parser = getParser(a);
   parser.setAllowLeadingWildcard(true);
   return parser.parse(query);
 }