Given the following unit test, I can easily test if a request of a particular url has been made. Is there a way to do the opposite, verify that a request of a particular url has NOT been made?
i.e. verify that a request was made:
stubFor(post(urlEqualTo("/login")));
webclient.submit(testLogin);
verify(postRequestedFor(urlMatching("/login")
What I'd like to do - Verify that a request was NOT made:
stubFor(post(urlEqualTo("/login")));
webclient.submit(testLogin);
verify(postRequestedFor(urlNotMatching("/login")
did you try
verify(exactly(0), postRequestedFor(urlEqualTo("/login")));
Basically checking if exactly 0 calls were made. To read more about it. see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With