First of all, thank you for your answer Vage.
We already have unit tests for all classes on our API. But now we are trying to generate integration tests (functional tests in Codeception) and we use to work with sandboxes, but our IT lead is asking us to avoid calls to external APIs and replace those connection service classes with stubs.
Does it has any sense to do this? If yes, how can we replace a class by stub on dependency container?