title: how to test method with try-with-resources
body: <p>how can I unit test a method which uses try-with-resources?</p>
  
  <p>As it uses new operator in try clause I cannot mock it. I don't want to use PowerMock. It seems like the only way is to create integration test?</p>
  
  <pre><code>public void methodToBeTested(File file) {
      try (FileInputStream fis = new FileInputStream(file)) {
          //some logic I want to test which uses fis object
      } catch (Exception e) {
          //print stacktrace
      }
  }
  </code></pre>