title: How do I mock `Files.exists()` OR `file.exists()` used inside another function using Mockito
body: <p>I have a function that checks to see if a file exists or not. If it does exist, it proceeds to execute some code. It's this code that I need to test.</p>
  <p>I cannot have an actual file in the test suite, so Im attempting to mock <code>Files.exists()</code> to have it return true.</p>
  <p>The function looks similar to this</p>
  <pre><code>protected function foo() {
  
      Path jsonPath = getPath();
  
      if (Files.exists(jsonPath)) {
          // Code to test...
      }
  }
  </code></pre>