While using WireMock to mock an endpoint that is expected to return JSON, I have come across a problem where it will not return the expected JSON. Querying WireMock for its stubs will reveal the correct JSON at the expected endpoint.
While running several datapoints against my theory I typically get 7 successfully passed tests before this problem occurs and the test fails. However, adding a sleep of about 5 seconds at the top of the theory allows all of the tests to pass. Wrapping the contents of the test in a loop will have it run one datapoint several times, which eventually fails. Adding in the sleep will allow it to run further, but eventually it serves up a null.
Is this a known issue? Is there a suitable workaround?