UriParamParser { public ParsedUriParams parseUriParams(Multimap<String, String> uriParams) { return parseUriParams(multimapToMultivaluedMap(uriParams)); } protected  UriParamParser(Set<String> ignoredParams); Set<String> getIgnoredParams(); Map<String, List<String>> multimapToMultivaluedMap(Multimap<String, String> map); ParsedUriParams parseUriParams(Multimap<String, String> uriParams); @SuppressWarnings("rawtypes") ParsedUriParams parseUriParams(Map<String, List<String>> uriParams); static Builder newBuilder(); static final Map<String, Filter> BY_NAME; }
@Test public void itRemovesReservedParams() { Map<String, List<String>> query = new HashMap<>(); query.put("offset", Lists.newArrayList("1")); query.put("limit", Lists.newArrayList("1")); query.put("includeDeleted", Lists.newArrayList("1")); query.put("order", Lists.newArrayList("1")); query.put("orderBy", Lists.newArrayList("1", "2")); final ParsedUriParams parsedUriParams = uriParamParser.parseUriParams(query); assertThat(parsedUriParams.getOrderBys()).hasSize(3); assertThat(parsedUriParams.getFieldFilters()).isEmpty(); }
@Test public void itPreservesCommasInEqValues() { Map<String, List<String>> query = Collections.singletonMap("name", Collections.singletonList("1,2,3")); final ParsedUriParams parsedUriParams = uriParamParser.parseUriParams(query); assertThat(parsedUriParams.getFieldFilters().get(0).getValue()).isEqualTo("1,2,3"); }