### Question:
HadoopQueueUtil { public static Set<String> getHadoopClusterQueueNamesHelper(String jsonResult, Set<String> qNames) throws JSONException { String qJson = extractRootQueuesElement(jsonResult); LOG.debug("Extracted Queue JSON - {}", qJson); JSONObject jObject = new JSONObject(qJson); LOG.debug("Parsing Json result done"); JSONObject queues = jObject.getJSONObject("queues"); jsonParseForHadoopQueueNames(queues, qNames); return qNames; } private  HadoopQueueUtil(); static String getHadoopClusterSchedulerInfo(String rmBaseUrlStr); static Set<String> getHadoopClusterQueueNamesHelper(String jsonResult, Set<String> qNames); static void jsonParseForHadoopQueueNames(JSONObject queues, Set<String> qNames); static String extractRootQueuesElement(String json); static Set<String> getHadoopClusterQueueNames(String rmBaseUrlStr);  }### Answer:
@Test public void testGetHadoopClusterQueueNamesHelper1() throws Exception { final InputStream inputStream = this.getClass().getResourceAsStream("/config/feed/feed-schedulerinfo-1.json"); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String jsonResult = ""; String line; while((line = br.readLine()) != null) { jsonResult += line; } Set<String> qNames = new HashSet<>(); HadoopQueueUtil.getHadoopClusterQueueNamesHelper(jsonResult, qNames); Assert.assertEquals(qNames.size(), 9); }
@Test public void testGetHadoopClusterQueueNamesHelper2() throws Exception { final InputStream inputStream = this.getClass().getResourceAsStream("/config/feed/feed-schedulerinfo-2.json"); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String jsonResult = ""; String line; while((line = br.readLine()) != null) { jsonResult += line; } Set<String> qNames = new HashSet<>(); HadoopQueueUtil.getHadoopClusterQueueNamesHelper(jsonResult, qNames); Assert.assertTrue(qNames.contains("default")); }