### Question:
JsonConversionUtil { @SuppressWarnings("unchecked") public static JSONObject fromRequest(HttpServletRequest request) throws JSONException { Map<String, String[]> params = request.getParameterMap(); if (!params.containsKey("method")) { return null; } JSONObject root = new JSONObject(); root.put("method", params.get("method")[0]); if (params.containsKey("id")) { root.put("id", params.get("id")[0]); } JSONObject paramsRoot = new JSONObject(); for (Map.Entry<String, String[]> entry : params.entrySet()) { if (!RESERVED_PARAMS.contains(entry.getKey().toLowerCase())) { String[] path = StringUtils.splitPreserveAllTokens(entry.getKey(), '.'); JSONObject holder = buildHolder(paramsRoot, path, 0); holder.put(path[path.length - 1], convertToJsonValue(entry.getValue()[0])); } } if (paramsRoot.length() > 0) { root.put("params", paramsRoot); } return root; } private  JsonConversionUtil(); @SuppressWarnings("unchecked") static JSONObject fromRequest(HttpServletRequest request); static Map<String, String> fromJson(JSONObject obj); static boolean isAllLiterals(JSONArray jsonArr);  }### Answer:
@Test public void testJsonFromRequest() throws Exception { HttpServletRequest fakeRequest; for (String badParms : ImmutableList.of("x=1", "x=1&callback=")) { fakeRequest = new FakeHttpServletRequest("http: assertNull(JsonConversionUtil.fromRequest(fakeRequest)); } }