### Question:
FindPackageNamesQuery extends AbstractFindQuery implements NamedQuery { @Override public Query toQuery(Set<ValueIndexTerm> terms) { final SearchEmptyQueryBuilder queryBuilder = new SearchEmptyQueryBuilder(); for (ValueIndexTerm term : terms) { if (term instanceof ValueModuleRootPathIndexTerm || term instanceof ValuePackageNameIndexTerm) { queryBuilder.addTerm(term); } } return queryBuilder.build(); }  @Override String getName(); @Override ResponseBuilder getResponseBuilder(); @Override Query toQuery(Set<ValueIndexTerm> terms); @Override void validateTerms(Set<ValueIndexTerm> queryTerms); static final String NAME; }### Answer:
@Test public void testToQuery() { final Query query = new FindPackageNamesQuery().toQuery(new HashSet<>()); assertEquals("", query.toString()); }
@Test public void testToQueryValueModuleRootPathIndexTerm() { final HashSet<ValueIndexTerm> terms = new HashSet<>(); terms.add(new ValueModuleRootPathIndexTerm("")); final Query query = new FindPackageNamesQuery().toQuery(terms); assertEquals("-projectRoot:*", query.toString()); }
@Test public void testToQueryValuePackageNameIndexTerm() { final HashSet<ValueIndexTerm> terms = new HashSet<>(); terms.add(new ValuePackageNameIndexTerm("")); final Query query = new FindPackageNamesQuery().toQuery(terms); assertEquals("-packageName:*", query.toString()); }