@Test(expected = IOException.class) public void testNotJSON() throws IOException { PowerMock.mockStatic(NetworkUtils.class); final String notJSON = "I am not json"; final URL url = PowerMock.createMock(URL.class); InputStream is = null; try { is = new ByteArrayInputStream(notJSON.getBytes()); NetworkUtils.getDataFromURL(url, null, ImageIngester.DEFAULT_CONNECT_TIMEOUT); PowerMock.expectLastCall().andReturn(notJSON.getBytes()); replayAll(); JSONParser.getJSONFromURL(url, null, ImageIngester.DEFAULT_CONNECT_TIMEOUT); } finally { if (is != null) { is.close(); } } fail("Source is invalid json"); }
public static JsonNode getJSONFromURL(final URL url, final int connectTimeout) throws IOException { return getJSONFromURL(url, null, connectTimeout); }
JSONParser { public static JsonNode getJSONFromURL(final URL url, final int connectTimeout) throws IOException { return getJSONFromURL(url, null, connectTimeout); } }
JSONParser { public static JsonNode getJSONFromURL(final URL url, final int connectTimeout) throws IOException { return getJSONFromURL(url, null, connectTimeout); } private  JSONParser(); }
JSONParser { public static JsonNode getJSONFromURL(final URL url, final int connectTimeout) throws IOException { return getJSONFromURL(url, null, connectTimeout); } private  JSONParser(); static JsonNode getJSONFromURL(final URL url, final int connectTimeout); static JsonNode getJSONFromURL(final URL url, final String expectedETag, final int connectTimeout); }
JSONParser { public static JsonNode getJSONFromURL(final URL url, final int connectTimeout) throws IOException { return getJSONFromURL(url, null, connectTimeout); } private  JSONParser(); static JsonNode getJSONFromURL(final URL url, final int connectTimeout); static JsonNode getJSONFromURL(final URL url, final String expectedETag, final int connectTimeout); static final ObjectMapper MAPPER; }