title: JUnit testing: Difference between never() and times(0)
body: <p>I just want to know that what is the difference between times(0) and never() in JUnit testing.</p>
  
  <p>For example I have the test line code for saving data in mongoDB:</p>
  
  <pre><code>verify(mockRepository,never()).save(any(User.class));
  </code></pre>
  
  <p>if I write it as: </p>
  
  <pre><code>verify(mockRepository,times(0)).save(any(User.class));
  </code></pre>
  
  <p>Both test shows that save method hasn't called. (correct me if I am wrong)
  Is there any difference between these two ?</p>