It is increasingly common for software to rely on external web services. These can be from a third party, such as the openweathermap.org API we saw in Chapter 4, Setting Up and Cleaning Up. However, we are likely to also interact with web services from within our own organization, or those that we have written ourselves. Not only do web services allow us to access external tools, such as weather info from openweathermap.org, they are also a popular approach to architecting applications within an organization. It is safe to say that an HTTP API is the default approach to exposing a service over a network today.
Dealing with external web services in tests can be challenging. By definition, these services are external, so we don't have as much, or any, control over how they behave, or how much support they offer for testing. As we saw in Chapter 4, Setting Up and Cleaning Up, we should try to avoid these external services in most tests, so we need to mock...