Integrating with the Service
We'll cover the following
Calling the web-service
We have one unfinished piece of work in the Airport
class—the fetchData()
function is pending implementation. We need to replace the exception in that function with code to talk to the web service. Since it needs a network connection to talk to an external service, the test for fetchData()
will be an integration test and not a unit test. We can’t get too specific about what to expect from the call, as details like delay will change frequently. Let’s write the integration test in a separate test class. Create a file named AirportIntegrationTest.kt
in the directory src/test/kotlin/com/agiledeveloper/airportstatus
and key in the following code:
Get hands-on with 1200+ tech skills courses.