IgIndexResponseParser { public static List<InstrumentInfo> createInstrumentInfoList(String json) throws IOException { checkNotNull(json); ImmutableList.Builder result = ImmutableList.builder(); JsonNode node = (new ObjectMapper()).readTree(json).get(TAG_MARKETS); checkNotNull(node, String.format("Tag [%s] not found in JSON text.", TAG_MARKETS)); for (int i = 0; i < node.size(); i++) { result.add(createInstrumentInfoForList(node.get(i))); } return result.build(); }  static IgIndexConnectionCredentials createConnectionCredentials(
      String apiKey, HttpClientResponse httpClientResponse); static List<InstrumentInfo> createInstrumentInfoList(String json); static InstrumentInfo createInstrumentInfo(String json);  }
@Test public void testCreateInstrumentInfoList() throws IOException { InputStream fileMarketSearchTermResponse = ClassLoader.getSystemResourceAsStream(FILE_MARKET_SEARCH_TERM_RESPONSE); List<InstrumentInfo> result = IgIndexResponseParser.createInstrumentInfoList( IOUtils.toString(fileMarketSearchTermResponse)); fileMarketSearchTermResponse.close(); assertNotNull(result); assertTrue(result.size() == 50); List<String> instrumentIds = Lists.newArrayList(); for (InstrumentInfo instrumentInfo : result) { assertInstrumentInfo(instrumentInfo); assertTrue(!instrumentIds.contains(instrumentInfo.getInstrumentId())); instrumentIds.add(instrumentInfo.getInstrumentId()); } }