BindNamesToQueryParams implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input is null") instanceof String[], "this binder is only valid for String[] arguments"); String[] names = (String[]) input; return (R) request.toBuilder().replaceQueryParam(NAME_KEY, names).build(); }  @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Object input);  }
@Test public void testBinding() { String[] input = { "hello", "world" }; HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: BindNamesToQueryParams binder = new BindNamesToQueryParams(); request = binder.bindToRequest(request, input); assertEquals(request.getRequestLine(), "GET http: }