Testing · Senior · Question 8 of 75
What does “don't mock what you don't own” suggest?
- ✓Correct answer: Wrap third-party APIs in your own adapter, mock the adapter in unit tests and check the adapter with integration tests
- 2Never use third-party libraries in tested code
- 3Mock every third-party library globally
Explanation
A mock of someone else's API encodes your assumptions about it; when the library changes, the mock still passes.