I want to verify Json.parse is never called in a function using unit test but i'm not using mockito correctly. would appreciate some help.
tried -
when(Json.parse(wsResponse.getBody())).thenThrow(new Exception("error msg"))
but got an error -
java.lang.RuntimeException: java.lang.NullPointerException
although method signature includes throws Exception.
- tried to use verify and never but verify waits for a function
something like this -
verify(Json.parse(wsResponse.getBody()),never());
but got an error - org.mockito.exceptions.misusing.NotAMockException: Argument passed to verify() is of type ObjectNode and is not a mock!
src I looked at -
https://www.baeldung.com/mockito-exceptions ** How can I test that a function has not been called? ** How to verify that a specific method was not called using Mockito? ** mockito testing verify with 0 calls