Skip to content

Tag: unit-testing

Why is the or-Matcher not working in my Mockito verify?

I would like to verify that either of the following two method calls get executed once: I have tried the following: But running the test method resulted in the following error: When I just test for a single method call as follows.. ..it runs fine and my test is always successful when logWarn() gets called wit…

REST. Checking the type of incoming field

how can I check the field type of the incoming response to the REST request. For example, I receive an answer with the “pay” field:”1000″ I want to check that the incoming field, its value is of type int What verification methods are there? Answer You can use Rest Assured Say you have …

Mockito expecting argument mismatch

I’m writing a Unit test with JUnit 4 and Mockito 4.6.1. I’m mocking an interface method with a specific input value. When a different value is passed, I’m expecting an argument mismatch error, but it’s not being thrown. Consider the following example: I’m mocking SomeInterface.te…