### Question:
FileDownloader { public InputStream downloadFile() throws IOException, URISyntaxException { URL url = new URL(myFileUrl); ResponseValues response = new ResponseValues(); @SuppressWarnings("PMD.PrematureDeclaration") InputStream stateStream = myServer.sendGet(url, response); if (response.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new IOException(response.getResponseMessage()); } return stateStream; } FileDownloader(HttpServer server, String fileUrl); InputStream downloadFile();  }### Answer:
@Test public void testDownloadFile() throws IOException, SAXException, ParserConfigurationException, URISyntaxException { HttpServer server = createServer(); EasyMock.replay(server); FileDownloader downloader = new FileDownloader(server, ourUrl); InputStream state = downloader.downloadFile(); Element stateFile = XMLUtilities.newDocumentBuilderNS().parse(state).getDocumentElement(); assertEquals("state", stateFile.getLocalName()); EasyMock.verify(server); }