January 2025
Intermediate to advanced
304 pages
7h 56m
English
This appendix contains the answers to the different chapter exercises found in the book.
The code can be added to the consumer-mobile/app/src/test/java/com/example/ movie/MoviesApiPactTest.kt test file:
@Pact(provider = "MoviesAPI", consumer = "MoviesAndroidApp") fun addMoviePact(builder: PactDslWithProvider): V4Pact { val requestBody: DslPart = PactDslJsonBody() .stringType("name") .integerType("year", 2004) val responseBody: DslPart = PactDslJsonBody() .integerType("id", 100) .stringType("name", "Shaun of the Dead") .integerType("year", 2004) return builder .given("movie doesn't exist") .uponReceiving("a request to add a movie") .path("/movies") .method("POST") ...Read now
Unlock full access