FieldSearchParam implements SearchParam { public Query getLuceneQuery() { QueryParser queryParser = new QueryParser(fieldName, SearchConstants.analyzer); if (value.startsWith("*")) { queryParser.setAllowLeadingWildcard(true); } try { return queryParser.parse(value); } catch (ParseException e) { e.printStackTrace(); } return null; } FieldSearchParam(String fieldName, String value); String getQuery(); Query getLuceneQuery(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testGetLuceneQuery_2() throws Exception { FieldSearchParam fixture = new FieldSearchParam("", ""); Query result = fixture.getLuceneQuery(); assertNull(result); }