title: How to access files from assets folder during tests execution?
body: <p>How to access files from assets folder during unit tests execution? My project is build using Gradle, I use Robolectric to run tests. It seems like gradle is being recognizing the <code>assets</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/SOcT1.png" alt="enter image description here"></p>
  
  <p>This is how I'm struggling to read the file:</p>
  
  <pre><code>public String readFileFromAssets(String fileName) throws IOException {
      InputStream stream = getClass().getClassLoader().getResourceAsStream("assets/" + fileName);
      Preconditions.checkNotNull(stream, "Stream is null");
      BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
      return IOUtils.toString(reader);
  }
  </code></pre>
  
  <p>But <code>stream</code> is always <code>null</code>. I tried it many different ways, i.e. defined path to a file using different approaches.</p>
  
  <p>Thank you very much in advance.</p>