### Question:
ProductListImpl extends ProductCollectionImpl implements ProductList { @Nonnull @Override public SearchResultsSet getSearchResultsSet() { if (searchResultsSet == null) { searchResultsSet = getCategorySearchResultsSet().getRight(); ((SearchResultsSetImpl) searchResultsSet).setSearchAggregations( searchResultsSet.getSearchAggregations() .stream() .filter(searchAggregation -> !SearchOptionsImpl.CATEGORY_ID_PARAMETER_ID.equals(searchAggregation.getIdentifier())) .collect(Collectors.toList())); } return searchResultsSet; }  @Nullable @Override String getTitle(); @Override boolean showTitle(); @Override String getImage(); @Override boolean showImage(); @Nonnull @Override Collection<ProductListItem> getProducts(); @Nonnull @Override SearchResultsSet getSearchResultsSet(); @Override AbstractCategoryRetriever getCategoryRetriever();  }### Answer:
@Test public void testSorting() { productListModel = context.request().adaptTo(ProductListImpl.class); SearchResultsSet resultSet = productListModel.getSearchResultsSet(); Assert.assertNotNull(resultSet); Assert.assertTrue(resultSet.hasSorting()); Sorter sorter = resultSet.getSorter(); Assert.assertNotNull(sorter); SorterKey currentKey = sorter.getCurrentKey(); Assert.assertNotNull(currentKey); Assert.assertEquals("price", currentKey.getName()); Assert.assertEquals("Price", currentKey.getLabel()); Assert.assertEquals(Sorter.Order.ASC, currentKey.getOrder()); Assert.assertTrue(currentKey.isSelected()); Map<String, String> currentOrderParameters = currentKey.getCurrentOrderParameters(); Assert.assertNotNull(currentOrderParameters); Assert.assertEquals(resultSet.getAppliedQueryParameters().size() + 2, currentOrderParameters.size()); resultSet.getAppliedQueryParameters().forEach((key, value) -> Assert.assertEquals(value, currentOrderParameters.get(key))); Assert.assertEquals("price", currentOrderParameters.get(Sorter.PARAMETER_SORT_KEY)); Assert.assertEquals("asc", currentOrderParameters.get(Sorter.PARAMETER_SORT_ORDER)); Map<String, String> oppositeOrderParameters = currentKey.getOppositeOrderParameters(); Assert.assertNotNull(oppositeOrderParameters); Assert.assertEquals(resultSet.getAppliedQueryParameters().size() + 2, oppositeOrderParameters.size()); resultSet.getAppliedQueryParameters().forEach((key, value) -> Assert.assertEquals(value, oppositeOrderParameters.get(key))); Assert.assertEquals("price", oppositeOrderParameters.get(Sorter.PARAMETER_SORT_KEY)); Assert.assertEquals("desc", oppositeOrderParameters.get(Sorter.PARAMETER_SORT_ORDER)); List<SorterKey> keys = sorter.getKeys(); Assert.assertNotNull(keys); Assert.assertEquals(2, keys.size()); SorterKey defaultKey = keys.get(0); Assert.assertEquals(currentKey.getName(), defaultKey.getName()); SorterKey otherKey = keys.get(1); Assert.assertEquals("name", otherKey.getName()); Assert.assertEquals("Product Name", otherKey.getLabel()); Assert.assertEquals(Sorter.Order.ASC, otherKey.getOrder()); }