Re:Tips to prevent adoption of your API
by patrickthebold on Wednesday June 16, 2021 @03:25PM
(#27532426)
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.
I may or may not actually test the implementation of that method.
In short: wrap up your external dependency.