### Question:
HostLogFilesRequestQueryConverter extends AbstractOperationHolderConverter<HostLogFilesRequest, SimpleFacetQuery> { @Override public SimpleFacetQuery convert(HostLogFilesRequest request) { SimpleFacetQuery facetQuery = new SimpleFacetQuery(); facetQuery.addCriteria(new SimpleStringCriteria(String.format("%s:(%s)", HOST, request.getHostName()))); if (StringUtils.isNotEmpty(request.getComponentName())) { facetQuery.addCriteria(new SimpleStringCriteria(String.format("%s:(%s)", COMPONENT, request.getComponentName()))); } FacetOptions facetOptions = new FacetOptions(); facetOptions.setFacetMinCount(1); facetOptions.setFacetLimit(-1); facetOptions.setFacetSort(FacetSort.COUNT); facetOptions.addFacetOnPivot(COMPONENT, PATH); facetQuery.setFacetOptions(facetOptions); addInFilterQuery(facetQuery, CLUSTER, splitValueAsList(request.getClusters(), ",")); facetQuery.setRows(0); return facetQuery; }  @Override SimpleFacetQuery convert(HostLogFilesRequest request); @Override LogType getLogType();  }### Answer:
@Test public void testConvertHostNameOnly() { HostLogFilesRequest request = new HostLogFilesQueryRequest(); request.setHostName("hostName"); SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request)); assertEquals("?q=host%3A%28hostName%29&rows=0&facet=true&facet.mincount=1&facet.limit=-1&facet.pivot=type%2Cpath", query.toQueryString()); }
@Test public void testConvertHostNameAndComponentName() { HostLogFilesRequest request = new HostLogFilesQueryRequest(); request.setHostName("hostName"); request.setComponentName("componentName"); SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request)); assertEquals("?q=host%3A%28hostName%29+AND+type%3A%28componentName%29&rows=0&facet=true&facet.mincount=1&facet.limit=-1" + "&facet.pivot=type%2Cpath", query.toQueryString()); }