### Question:
HttpGet { public String getSomeThing(String urlStr) throws IOException { URL url = new URL(urlStr); HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.setConnectTimeout(3000); urlConn.setRequestMethod("GET"); urlConn.connect(); InputStream ins = null; try { if (200 == urlConn.getResponseCode()) { ins = urlConn.getInputStream(); ByteArrayOutputStream outs = new ByteArrayOutputStream(1024); IOUtils.copy(ins, outs); return outs.toString("UTF-8"); } } catch (IOException e) { throw e; } finally { IOUtils.closeQuietly(ins); } return null; }  String getSomeThing(String urlStr);  }### Answer:
@Test public void testGetSomeThing4Success() throws Exception { String response = "Hello, The World!"; _mock.start(response, "text/plain"); String content = _httpGet.getSomeThing("http: assertEquals(response, content); }
@Test public void testGetSomeThing4Fail() throws Exception { String response = "Hello, The World!"; _mock.start(response, "text/plain", 500); String content = _httpGet.getSomeThing("http: assertNull(content); }