Closed Farcasut closed 6 months ago
You can mock Apache commons HttpClient by creating a component that returns the builder similar to this example, and then you can mock that component in the test to return a mock client. See this unit test for an example.
I removed the real IP address from the tests and also deleted a test because I couldn't mock the static method used to create the HttpClient that makes the requests. I tried following the steps outlined in this resource for mocking a static method, but xwiki is missing the mockito-inline dependency.