title: How can I test Json.parser is not called with mockito java?
body: <p>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.</p>
  <p>tried -</p>
  <ol>
  <li><code>when(Json.parse(wsResponse.getBody())).thenThrow(new Exception(&quot;error msg&quot;))</code></li>
  </ol>
  <p>but got an error -
  <code>java.lang.RuntimeException: java.lang.NullPointerException</code> although method signature includes throws Exception.</p>
  <ol start="2">
  <li>tried to use verify and never but verify waits for a function</li>
  </ol>
  <p>something like this -</p>
  <p><code>verify(Json.parse(wsResponse.getBody()),never());</code></p>
  <p>but got an error - <code> org.mockito.exceptions.misusing.NotAMockException:  Argument passed to verify() is of type ObjectNode and is not a mock!</code></p>
  <p>src I looked at -</p>
  <blockquote>
  <p><a href="https://www.baeldung.com/mockito-exceptions" rel="nofollow noreferrer">https://www.baeldung.com/mockito-exceptions</a> **
  <a href="https://stackoverflow.com/questions/24282390/how-can-i-test-that-a-function-has-not-been-called">How can I test that a function has not been called?</a> **
  <a href="https://stackoverflow.com/questions/12862659/how-to-verify-that-a-specific-method-was-not-called-using-mockito">How to verify that a specific method was not called using Mockito?</a> **
  <a href="https://stackoverflow.com/questions/40772389/mockito-testing-verify-with-0-calls">mockito testing verify with 0 calls</a></p>
  </blockquote>