Params { public Map<String, String> parse(Request request, String... exclusions) { RequestExt req = (RequestExt) request; List<String> exclusionsList = Arrays.asList(exclusions); Map<String, String> params = Maps.newHashMap(); for (String key : req.params().keySet()) { String value = request.param(key) == null ? "" : request.param(key); if (!Strings.isNullOrEmpty(value) && !exclusionsList.contains(key)) { params.put(key, value); } } return params; }  Map<String, String> parse(Request request, String... exclusions);  }
@Test public void parse() throws Exception { Map<String, String> params = new Params().parse(aNewRequest().param("::index::", "::1::").build()); assertThat(params, CoreMatchers.<Map<String, String>>is(of("::index::", "::1::"))); }
@Test public void excludeParams() throws Exception { Request request = aNewRequest().param("::i::", "::1::").param("::codeparam::", "::1::").param("::otherparam::", "::1::").build(); Map<String, String> params = new Params().parse(request, "::codeparam::", "::otherparam::"); assertThat(params, CoreMatchers.<Map<String, String>>is(of("::i::", "::1::"))); }