### Question:
QueryUtil { public static JSONObject extractAggregationStr(String response) { JSONObject jsonResp = new JSONObject(); try { jsonResp = new JSONObject(response); jsonResp = extractValueForKey(jsonResp, "aggregations"); if (jsonResp != null) { jsonResp = keyConvert(jsonResp,"sum#"); } } catch (JSONException e) { LOGGER.error(e.getMessage()); } return jsonResp; } private  QueryUtil(); static JSONObject extractAggregationValue(SearchResponse response); static ArrayList toList(JSONArray array); static Map<String, Object> toMap(JSONObject object); static JSONObject extractAggregationStr(String response);  }### Answer:
@Test public void extractAggregationStr() { String resp = "{\n" + " \"took\" : 1,\n" + " \"timed_out\" : false,\n" + " \"_shards\" : {\n" + " \"total\" : 5,\n" + " \"successful\" : 5,\n" + " \"skipped\" : 0,\n" + " \"failed\" : 0\n" + " },\n" + " \"hits\" : {\n" + " \"total\" : 85,\n" + " \"max_score\" : 0.0,\n" + " \"hits\" : [ ]\n" + " },\n" + " \"aggregations\" : {\n" + " \"count\" : {\n" + " \"value\" : 0.0\n" + " }\n" + " }\n" + "}\n"; JSONObject res = QueryUtil.extractAggregationStr(resp); assertEquals("{\"value\":0}", res.get("count").toString()); }