I'm connecting to a simple, if idiosyncractic, external service.
I believe that my unit tests should not depend on the availability or implementation of that external service, so I intend to mock it out.
I need the mock to accept and return realistic messages and responses - otherwise my tests won't represent real states of affairs. For example, it has to throw the right kind of errors - and there are at least 7 different ways it can fail (between you and me it's not a very well designed external service). Therefore, at a bare minimum I have to have a hash of message/response pairs.
So instead of reducing contingency, mocking has reintroduced it somewhere else. In fact, as the saying goes, now I've got two problems: I've got to be sure that what's in my hash is a fair representation of how the external service behaves. But surely the canonical source of what response object X gives to message m is X itself. Anything else is risky and messy.
Have I taken a wrong turn? How can I eliminate this apparent circularity?
EDIT I've clarified what I think the problem is in the light of Justice's helpful comments.