@Test public void testCorrectSearchFiltersAfterConvert() throws Exception { populateDiscoveryConfigurationWithEmptyList(); LinkedList<DiscoverySearchFilter> mockedList = new LinkedList(); DiscoverySearchFilter discoverySearchFilter = new DiscoverySearchFilter(); discoverySearchFilter.setIndexFieldName("title"); DiscoverySearchFilter discoverySearchFilter1 = new DiscoverySearchFilter(); discoverySearchFilter1.setIndexFieldName("title2"); mockedList.add(discoverySearchFilter); mockedList.add(discoverySearchFilter1); when(discoveryConfiguration.getSearchFilters()).thenReturn(mockedList); searchConfigurationRest = discoverConfigurationConverter.convert(discoveryConfiguration, Projection.DEFAULT); int counter = 0; for (SearchConfigurationRest.Filter filter : searchConfigurationRest.getFilters()) { DiscoverySearchFilter searchFilter = mockedList.get(counter); assertEquals(searchFilter.getIndexFieldName(), filter.getFilter()); SearchConfigurationRest.Filter.Operator operator = new SearchConfigurationRest.Filter.Operator("testing"); filter.addOperator(operator); assertEquals(filter.getOperators().get(filter.getOperators().size() - 1), operator); counter++; } assertTrue(!(searchConfigurationRest.getFilters().isEmpty())); }
@Override public SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection) { SearchConfigurationRest searchConfigurationRest = new SearchConfigurationRest(); searchConfigurationRest.setProjection(projection); if (configuration != null) { addSearchFilters(searchConfigurationRest, configuration.getSearchFilters(), configuration.getSidebarFacets()); addSortOptions(searchConfigurationRest, configuration.getSearchSortConfiguration()); setDefaultSortOption(configuration, searchConfigurationRest); } return searchConfigurationRest; }
DiscoverConfigurationConverter implements DSpaceConverter<DiscoveryConfiguration, SearchConfigurationRest> { @Override public SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection) { SearchConfigurationRest searchConfigurationRest = new SearchConfigurationRest(); searchConfigurationRest.setProjection(projection); if (configuration != null) { addSearchFilters(searchConfigurationRest, configuration.getSearchFilters(), configuration.getSidebarFacets()); addSortOptions(searchConfigurationRest, configuration.getSearchSortConfiguration()); setDefaultSortOption(configuration, searchConfigurationRest); } return searchConfigurationRest; } }
DiscoverConfigurationConverter implements DSpaceConverter<DiscoveryConfiguration, SearchConfigurationRest> { @Override public SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection) { SearchConfigurationRest searchConfigurationRest = new SearchConfigurationRest(); searchConfigurationRest.setProjection(projection); if (configuration != null) { addSearchFilters(searchConfigurationRest, configuration.getSearchFilters(), configuration.getSidebarFacets()); addSortOptions(searchConfigurationRest, configuration.getSearchSortConfiguration()); setDefaultSortOption(configuration, searchConfigurationRest); } return searchConfigurationRest; }  }
DiscoverConfigurationConverter implements DSpaceConverter<DiscoveryConfiguration, SearchConfigurationRest> { @Override public SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection) { SearchConfigurationRest searchConfigurationRest = new SearchConfigurationRest(); searchConfigurationRest.setProjection(projection); if (configuration != null) { addSearchFilters(searchConfigurationRest, configuration.getSearchFilters(), configuration.getSidebarFacets()); addSortOptions(searchConfigurationRest, configuration.getSearchSortConfiguration()); setDefaultSortOption(configuration, searchConfigurationRest); } return searchConfigurationRest; }  @Override SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection); @Override Class<DiscoveryConfiguration> getModelClass(); void addSearchFilters(SearchConfigurationRest searchConfigurationRest,
                                 List<DiscoverySearchFilter> searchFilterList,
                                 List<DiscoverySearchFilterFacet> facetList); }
DiscoverConfigurationConverter implements DSpaceConverter<DiscoveryConfiguration, SearchConfigurationRest> { @Override public SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection) { SearchConfigurationRest searchConfigurationRest = new SearchConfigurationRest(); searchConfigurationRest.setProjection(projection); if (configuration != null) { addSearchFilters(searchConfigurationRest, configuration.getSearchFilters(), configuration.getSidebarFacets()); addSortOptions(searchConfigurationRest, configuration.getSearchSortConfiguration()); setDefaultSortOption(configuration, searchConfigurationRest); } return searchConfigurationRest; }  @Override SearchConfigurationRest convert(DiscoveryConfiguration configuration, Projection projection); @Override Class<DiscoveryConfiguration> getModelClass(); void addSearchFilters(SearchConfigurationRest searchConfigurationRest,
                                 List<DiscoverySearchFilter> searchFilterList,
                                 List<DiscoverySearchFilterFacet> facetList);  }