### Question:
HttpServerImpl implements HttpServer { @Override public CancellableInputStream postFile(URL postToURL, Map<String, String> metaDataParts, File fileToPost, ResponseValues response) throws IOException, URISyntaxException { assert !EventQueue.isDispatchThread(); assert !Platform.isFxApplicationThread(); return myRequestorProvider.getFilePoster().postFileToServer(postToURL, metaDataParts, fileToPost, response); } HttpServerImpl(String host, String protocol, RequestorProvider requestorProvider); @Override String getHost(); @Override String getProtocol(); RequestorProvider getRequestProvider(); @Override CancellableInputStream postFile(URL postToURL, Map<String, String> metaDataParts, File fileToPost,
            ResponseValues response); @Override CancellableInputStream postFile(URL postToURL, File fileToPost, ResponseValues response); @Override Pair<String, Integer> resolveProxy(URL destination); @Override Proxy resolveProxyConfig(URL destination); @Override CancellableInputStream sendDelete(URL url, ResponseValues response); @Override CancellableInputStream sendDelete(URL url, Map<String, String> extraHeaderValues, ResponseValues response); @Override CancellableInputStream sendGet(URL url, Map<String, String> extraHeaderValues, ResponseValues response); @Override CancellableInputStream sendGet(URL url, ResponseValues response); @Override void sendHead(URL url, Map<String, String> extraHeaderValues, ResponseValues response); @Override void sendHead(URL url, ResponseValues response); @Override CancellableInputStream sendPost(URL url, InputStream postData, Map<String, String> extraHeaderValues,
            ResponseValues response, ContentType contentType); @Override CancellableInputStream sendPost(URL url, InputStream postData, ResponseValues response); @Override CancellableInputStream sendPost(URL url, InputStream postData, ResponseValues response, ContentType contentType); @Override CancellableInputStream sendPost(URL url, Map<String, String> extraHeaderValues, Map<String, String> postData,
            ResponseValues response); @Override CancellableInputStream sendPost(URL url, Map<String, String> postData, ResponseValues response); @Override void setBufferSize(int bufferSize); @Override void setTimeouts(int readTimeout, int connectTimeout);  }### Answer:
@Test public void testPostFile() throws IOException, URISyntaxException { EasyMockSupport support = new EasyMockSupport(); URL url = new URL(ourUrl); File tempFile = new File("."); ResponseValues response = new ResponseValues(); CancellableInputStream expectedReturn = new CancellableInputStream(new ByteArrayInputStream(new byte[0]), null); FilePostRequestor requestor = support.createMock(FilePostRequestor.class); requestor.postFileToServer(EasyMock.eq(url), EasyMock.eq(tempFile), EasyMock.eq(response)); EasyMock.expectLastCall().andReturn(expectedReturn); RequestorProvider provider = support.createMock(RequestorProvider.class); provider.getFilePoster(); EasyMock.expectLastCall().andReturn(requestor); support.replayAll(); HttpServerImpl server = new HttpServerImpl(null, null, provider); InputStream actualStream = server.postFile(url, tempFile, response); assertEquals(expectedReturn, actualStream); support.verifyAll(); }