【发布时间】:2015-03-12 14:09:24
【问题描述】:
我知道如何模拟 default HttpClient,但如何模拟使用 PoolingHttpClientConnectionManager 和 Mockito 创建的最新 (v4.4) HttpClient?
我的代码如下所示:
PoolingHttpClientConnectionManager mgr = new PoolingHttpClientConnectionManager();
...
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(mgr).build();
HttpResponse response = httpClient.execute(request);
... // here I want to substitute a mocked HttpResponse
【问题讨论】:
标签: java mockito apache-httpclient-4.x