IfNotNullBindAvailabilityZoneToFormParam implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { if (input != null) { checkArgument(input instanceof String, "this binder is only valid for String!"); return (R) request.toBuilder().replaceFormParam(param, String.class.cast(input)).build(); } return request; } @Inject protected  IfNotNullBindAvailabilityZoneToFormParam(); protected  IfNotNullBindAvailabilityZoneToFormParam(String param); @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Object input);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testMustBeString() { HttpRequest request = HttpRequest.builder().method("POST").endpoint("http: binder.bindToRequest(request, new File("foo")); }