@Test public void convertAuthorContainsSearchFilterTest() { SearchFilter searchFilter = new SearchFilter("author", "query", "test*"); List<SearchFilter> list = new LinkedList<>(); list.add(searchFilter); List<SearchFilter> transformedList = searchQueryConverter.convert(list); assertEquals(transformedList.get(0).getOperator(), "contains"); assertEquals(list.get(0).getOperator(), "query"); assertEquals(transformedList.get(0).getName(), "author"); assertEquals(list.get(0).getName(), "author"); assertEquals(transformedList.get(0).getValue(), "test"); assertEquals(list.get(0).getValue(), "test*"); }
public List<SearchFilter> convert(List<SearchFilter> searchFilters) { List<SearchFilter> transformedSearchFilters = new LinkedList<>(); for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(searchFilters)) { if (StringUtils.equals(searchFilter.getOperator(), "query")) { SearchFilter transformedSearchFilter = convertQuerySearchFilterIntoStandardSearchFilter(searchFilter); transformedSearchFilters.add(transformedSearchFilter); } else { transformedSearchFilters.add(searchFilter); } } return transformedSearchFilters; }
SearchQueryConverter { public List<SearchFilter> convert(List<SearchFilter> searchFilters) { List<SearchFilter> transformedSearchFilters = new LinkedList<>(); for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(searchFilters)) { if (StringUtils.equals(searchFilter.getOperator(), "query")) { SearchFilter transformedSearchFilter = convertQuerySearchFilterIntoStandardSearchFilter(searchFilter); transformedSearchFilters.add(transformedSearchFilter); } else { transformedSearchFilters.add(searchFilter); } } return transformedSearchFilters; } }
SearchQueryConverter { public List<SearchFilter> convert(List<SearchFilter> searchFilters) { List<SearchFilter> transformedSearchFilters = new LinkedList<>(); for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(searchFilters)) { if (StringUtils.equals(searchFilter.getOperator(), "query")) { SearchFilter transformedSearchFilter = convertQuerySearchFilterIntoStandardSearchFilter(searchFilter); transformedSearchFilters.add(transformedSearchFilter); } else { transformedSearchFilters.add(searchFilter); } } return transformedSearchFilters; }  }
SearchQueryConverter { public List<SearchFilter> convert(List<SearchFilter> searchFilters) { List<SearchFilter> transformedSearchFilters = new LinkedList<>(); for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(searchFilters)) { if (StringUtils.equals(searchFilter.getOperator(), "query")) { SearchFilter transformedSearchFilter = convertQuerySearchFilterIntoStandardSearchFilter(searchFilter); transformedSearchFilters.add(transformedSearchFilter); } else { transformedSearchFilters.add(searchFilter); } } return transformedSearchFilters; }  List<SearchFilter> convert(List<SearchFilter> searchFilters); SearchFilter convertQuerySearchFilterIntoStandardSearchFilter(SearchFilter searchFilter); }
SearchQueryConverter { public List<SearchFilter> convert(List<SearchFilter> searchFilters) { List<SearchFilter> transformedSearchFilters = new LinkedList<>(); for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(searchFilters)) { if (StringUtils.equals(searchFilter.getOperator(), "query")) { SearchFilter transformedSearchFilter = convertQuerySearchFilterIntoStandardSearchFilter(searchFilter); transformedSearchFilters.add(transformedSearchFilter); } else { transformedSearchFilters.add(searchFilter); } } return transformedSearchFilters; }  List<SearchFilter> convert(List<SearchFilter> searchFilters); SearchFilter convertQuerySearchFilterIntoStandardSearchFilter(SearchFilter searchFilter);  }