I'm using apache http client version 5.x, and I'm struglling to implement mocked unit tests for the CloseableHttpResponse execute(ClassicHttpRequest request)
method from CloseableHttpClient
class, since the response type is final and there is no public way to instantiate it.
The following question provided some ways to do it, but the discussion seems to be around the older versions of the apache http client, and although I was able to enable mockito to mock final types, it seems to be risky, as documentation itself warns that this is a completely different mocking mechanism that requires more feedback from the community.
Is there an easier/proper way to achieve this?