I have spring boot application which calls a remote api service. The remote service can throw various exception conditions that include 1. Service not available 2. Parsing error . So we want to replicate those scenarios in our local environment to make sure our code handles those error response structure . If the remote service were able to provide such test cases this would have been easier but they said it is dynamically generated . I have been trying to research on how to create or induce those conditions but could not find anything as such . Even the slightest points would be of great help at this moment . Thank you.
Asked
Active
Viewed 139 times
0
-
You can create these scenarios by writing test cases – Ryuzaki L Nov 06 '19 at 00:48
-
Possible duplicate of [How to mock remote REST API in unit test with Spring?](https://stackoverflow.com/questions/25564533/how-to-mock-remote-rest-api-in-unit-test-with-spring) – Tom Nov 06 '19 at 00:49
1 Answers
0
Check documentation and complete guide with examples for MockRestServiceServer
.
I hope it'll solve your problem.

Sanket Patel
- 227
- 1
- 14