Mocking Apache HttpClient 4.4 PoolingHttpClientConnectionManager

Ich wissen, wie mock ein Standard HttpClient, aber wie kann ich verspotte die aktuellen (v4.4) HttpClient, die erstellt wird, mithilfe einer PoolingHttpClientConnectionManager mit Mockito?

Mein code sieht wie folgt aus:

PoolingHttpClientConnectionManager mgr = new PoolingHttpClientConnectionManager();
...
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(mgr).build();
HttpResponse response = httpClient.execute(request);            
... //here I want to substitute a mocked HttpResponse
InformationsquelleAutor rustyx | 2015-03-12
Schreibe einen Kommentar