WebActionRequestHandler extends SimpleRequestHandler<WebActionRequest, JsonObject> { public JsonObject delegateJsonRequest(@Nonnull JsonObject request) { try { requireNonNull(request, "request may not be null"); return delegateRequest(GSON.fromJson(request, DefaultWebActionRequest.class)); } catch (JsonSyntaxException e) { LOG.error("request failed with", e); return createJsonResponse(null, Collections.emptyMap(), Status.INTERNAL_SERVER_ERROR); } }  JsonObject delegateJsonRequest(@Nonnull JsonObject request);  }
@Test public void delegateJsonRequest_InvalidJsonGiven_ShouldFailWith500() { JsonObject request = minimalRequestBuilder() .buildJson(); request.addProperty("__ow_headers", true); JsonObject response = handler.delegateJsonRequest(request); assertEquals(createResponse(null, Collections.emptyMap(), Status.INTERNAL_SERVER_ERROR), response); }