The folder timezones
contains a simple project that gets timezone information from the World Time API.
The class TimeZoneService
depends on WorldTimeApiHttpClient
that consults the API, we need to test TimeZoneService
but WorldTimeApiHttpClient
relies on the external API.
- Create an interface for
WorldTimeApiHttpClient
, name it justWorldTimeApiClient
. - Use the new interface to create a fake class.
- Use the fake class to create a unit test testing
TimeZoneService
.