3 ms·
It depends on a lot of things, but let's say (for concreteness) you are using Java or something similar. I'd write classes to represent the request and response
by patrickthebold 5y ago
It depends on a lot of things, but let's say (for concreteness) you are using Java or something similar. I'd write classes to represent the request and response models, call them A and B. Then I'd write a interface/class with a method from A to Future<B>. That method would be mocked everywhere, and most of your code doesn't deal with the API nonsense. (B is the data you want not the link to get the data.)
I may or may not actually test the implementation of that method.
In short: wrap up your external dependency.