![]() ![]() Further information can be found directly on the MockWebServer’s Github page. You could have business logic that utilizes the response to which you can add further verification.įor providing testing across microservice boundaries, MockWebServer provides a simple, easy-to-implement option for those wanting to test service-to-service communications. Take the response from your service and verify that it matches what you expect.Note: You can add multiple responses to this queue which will be provided in typical sequential fashion, FIFO (First In, First Out).This will put your response on the mock server’s queue. Queue up a response from your mock web server.Next, test the inbound response from B to A: Then we are using AssertJ to verify the values of the request object. ![]() We are taking the request as a string and using Jackson’s ObjectMapper class to map the request string to an object. Of particular interest is the body that was sent with the request, which can be verified as demonstrated in the example code below. MockWebServer is a great tool for mocking network requests/responses. This may include the url or the method (POST, GET, PUT, etc.) that was used.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |