title: Mockito - Mocking a method with parameters
body: <p>I am writing unit tests for a method that takes in argument <code>id</code> which is something like below :</p>
  
  <pre><code> public void searchid(String id) {
      Document doc = Repository.findDocument(id); //returns a document
      if (doc == null) {
        System.out.println("id missing");
      } else {
        String stringRecord = doc.asJsonString(); //converting doc to string
  </code></pre>
  
  <p>Here <code>Repository.findDocument(id)</code> is returning a document.
  In my unit test, I am getting the JSON file from <code>src/test/resources</code>. So, how do I mock <code>Repository.findDocument(id)</code>, so as to fetch the file from my resource instead ?</p>
  
  <p>Thanks,</p>