Skip to content
Advertisement

Tag: mockwebserver

Mocking nested retrofit api calls using MockWebServer

I am writing a junit test using okhttp3.mockwebserver for a retrofit2 rest api. The trimmed down api looks like this: The api is then injected to another class which delegates the calls thusly: I do the following in my test: Because the implementation of cancelOrder() calls api.cancelOrder() and then api.getOrders(), I added two mocked responses corresponding to each. However, looks

Could not transfer artifact com.squareup.okhttp3:mockwebserver:pom:4.9.1 from/to central (https://repo.maven.apache.org/maven2)

I have encountered a problem while importing the MockWebServer dependencies into my project Idea is showing 2 problems: Dependency ‘com.squareup.okhttp3:okhttp:4.9.1’ not found Dependency ‘com.squareup.okhttp3:mockwebserver:4.9.1’ not found And reload all maven projects results in a big “stacktrace” which generally says that it can’t resolve any of the dependencies. Running maven goal compile results in an error: Could not transfer artifact com.squareup.okhttp3:okhttp:pom:4.9.1

Advertisement