Should you only create a mock object to replace code that calls external apis, databases, etc?
What if I am testing a class A, that uses another class B, with very complex functionality. I can see that class B does not call any external apis or make any database calls. I can see that class B uses three other classes...C, D, and E and I don't know if C, D and E call external apis or not.
Should I
a) create a mock object to replace B
b) investigate C, D and E to see what they do
The problem with "b" is that C, D, and E can also use many classes each of which would need to be investigated and at least partially understood.
It is clear that this code is tightly coupled and needs to be re-written in the long term. But I am trying to write some unit test cases and my short term constraint is that I can not modify the classes that are being tested.
Thank you.