@Test public void testMap() throws SecurityException, NoSuchMethodException { HttpHealthCheckCreationBinder binder = new HttpHealthCheckCreationBinder(json); HttpHealthCheckCreationOptions httpHealthCheckCreationOptions = new HttpHealthCheckCreationOptions.Builder() .timeoutSec(TIMEOUTSEC) .unhealthyThreshold(UNHEALTHYTHRESHOLD) .healthyThreshold(HEALTHYTHRESHOLD) .description(DESCRIPTION) .buildWithDefaults(); HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: Map<String, Object> postParams = ImmutableMap.of("name", NAME, "options", httpHealthCheckCreationOptions); binder.bindToRequest(request, postParams); assertEquals(request.getPayload().getRawContent(), "{" + "\"name\":\"" + NAME + "\"," + "\"requestPath\":\"/\"," + "\"port\":80," + "\"checkIntervalSec\":5," + "\"timeoutSec\":" + TIMEOUTSEC + "," + "\"unhealthyThreshold\":" + UNHEALTHYTHRESHOLD + "," + "\"healthyThreshold\":" + HEALTHYTHRESHOLD + "," + "\"description\":\"" + DESCRIPTION + "\"" + "}"); assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json"); }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { HttpHealthCheckCreationOptions options = (HttpHealthCheckCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options); return super.bindToRequest(request, helper); }
HttpHealthCheckCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { HttpHealthCheckCreationOptions options = (HttpHealthCheckCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options); return super.bindToRequest(request, helper); } }
HttpHealthCheckCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { HttpHealthCheckCreationOptions options = (HttpHealthCheckCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options); return super.bindToRequest(request, helper); } @Inject  HttpHealthCheckCreationBinder(Json jsonBinder); }
HttpHealthCheckCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { HttpHealthCheckCreationOptions options = (HttpHealthCheckCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options); return super.bindToRequest(request, helper); } @Inject  HttpHealthCheckCreationBinder(Json jsonBinder); @Override R bindToRequest(R request, Map<String, Object> postParams); }
HttpHealthCheckCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { HttpHealthCheckCreationOptions options = (HttpHealthCheckCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options); return super.bindToRequest(request, helper); } @Inject  HttpHealthCheckCreationBinder(Json jsonBinder); @Override R bindToRequest(R request, Map<String, Object> postParams);  }