### Question:
SearchResultsServiceImpl implements SearchResultsService { @Nonnull @Override public SearchResultsSet performSearch( final SearchOptions searchOptions, final Resource resource, final Page productPage, final SlingHttpServletRequest request) { return performSearch(searchOptions, resource, productPage, request, null); } SearchResultsServiceImpl();  SearchResultsServiceImpl(final MagentoGraphqlClient magentoGraphqlClient); @Nonnull @Override SearchResultsSet performSearch(
        final SearchOptions searchOptions,
        final Resource resource,
        final Page productPage,
        final SlingHttpServletRequest request); @Nonnull @Override SearchResultsSet performSearch(
        final SearchOptions searchOptions,
        final Resource resource,
        final Page productPage,
        final SlingHttpServletRequest request,
        final Consumer<ProductInterfaceQuery> productQueryHook); @Nonnull @Override Pair<CategoryInterface, SearchResultsSet> performSearch(
        final SearchOptions searchOptions,
        final Resource resource,
        final Page productPage,
        final SlingHttpServletRequest request,
        final Consumer<ProductInterfaceQuery> productQueryHook,
        final AbstractCategoryRetriever categoryRetriever);  }### Answer:
@Test public void testPerformSearch() { SearchOptionsImpl searchOptions = new SearchOptionsImpl(); searchOptions.setPageSize(6); searchOptions.setSearchQuery(SEARCH_QUERY); searchOptions.setCurrentPage(1); Map<String, String> filters = new HashMap<>(); filters.put(FILTER_ATTRIBUTE_NAME_CODE, "sport"); filters.put(FILTER_ATTRIBUTE_COLOR_CODE, "red"); filters.put(FILTER_ATTRIBUTE_PRICE1_CODE, "20_30"); filters.put(FILTER_ATTRIBUTE_PRICE2_CODE, "40_*"); filters.put(FILTER_ATTRIBUTE_PRICE3_CODE, "*_50"); filters.put(FILTER_ATTRIBUTE_PRICE4_CODE, "60"); filters.put(FILTER_ATTRIBUTE_PRICE5_CODE, "*"); filters.put(FILTER_ATTRIBUTE_BOOLEAN_CODE, "1"); searchOptions.setAttributeFilters(filters); SearchResultsSet searchResultsSet = serviceUnderTest.performSearch( searchOptions, resource, productPage, request); ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class); verify(magentoGraphqlClient, times(1)).execute(captor.capture()); verify(searchFilterService, times(1)).retrieveCurrentlyAvailableCommerceFilters(any()); assertThat(searchResultsSet).isNotNull(); assertThat(searchResultsSet.getTotalResults()).isEqualTo(0); assertThat(searchResultsSet.getAppliedQueryParameters()).containsKeys("search_query"); assertThat(searchResultsSet.getProductListItems()).isEmpty(); String query = captor.getValue(); assertThat(query).contains("search:\"pants\""); assertThat(query).contains("name:{match:\"sport\"}"); assertThat(query).contains("color:{eq:\"red\"}"); assertThat(query).contains("price1:{from:\"20\",to:\"30\"}"); assertThat(query).contains("price2:{from:\"40\"}"); assertThat(query).contains("price3:{to:\"50\"}"); assertThat(query).contains("price4:{from:\"60\",to:\"60\"}"); assertThat(query).doesNotContain("price5:"); assertThat(query).contains("is_new:{eq:\"1\"}"); }
@Test public void testExtendProductQuery() { SearchOptionsImpl searchOptions = new SearchOptionsImpl(); searchOptions.setPageSize(6); searchOptions.setSearchQuery(SEARCH_QUERY); searchOptions.setCurrentPage(1); serviceUnderTest.performSearch( searchOptions, resource, productPage, request, p -> p.createdAt() .addCustomSimpleField("is_returnable")); ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class); verify(magentoGraphqlClient, times(1)).execute(captor.capture()); assertThat(captor.getValue()).contains("created_at,is_returnable_custom_:is_returnable"); }