Skip to content
Advertisement

Tag: mockito

Mockito is returning the incorrect response when testing a controller

I Have a misterius. Im trying to write a Test for this controller Method: And I DID this: I don’t know why but the method ResponseEntity<Object> response = controller.getIncidencia(ID); is returning <404 NOT_Found Not Found, Incidencia Not Found []> But the corret would be 200 OK. What I did Wrong? Answer I discovered but I do know why. I re-wrote

Mockito when() in parallel stream unexpected result

I was investigating Mockito’s behavior in one of our tests and I didn’t understand its behavior. The following code snippets shows the same behavior : The output I was expecting is prints of 1,2,3 in some order (not nessaseraly sorted) : The output I received : Why I got this output ? Answer This is a classic race condition: your

Advertisement