UnsdRequest { public String getTargets() { Map<String, String> params = Collections.singletonMap("includechildren", "true"); return getData(PATH_TARGETS.replace(PLACEHOLDER_GOAL, goal), params); } UnsdRequest(UnsdConfig config); void setGoal(String goal); void setIndicator(String indicator); void nextPage(); void setAreaCodes(String[] areaCodes); String getTargets(); String getDimensions(); String getIndicatorData(StatisticalIndicatorDataModel selectors);  }
@Test @Ignore("Requires external HTTP requests to be made") public void testRequestTargets() throws JSONException { org.junit.Assume.assumeTrue(TestHelper.canDoHttp()); org.junit.Assume.assumeTrue(TestHelper.redisAvailable()); String json = request.getTargets(); Asserts.assertNotNull(json, "Targets response is null."); assertNotEquals("Targets response is empty.", "", json); JSONObject goal = getFirstObject(json); assertTrue("Goal has no targets.", goal.has("targets")); JSONArray targets = goal.getJSONArray("targets"); for (int i = 0; i < targets.length(); i++) { JSONObject target = targets.getJSONObject(i); assertTrue("Target has no indicators", target.has("indicators")); } }