title: Reading File Assets for Tests in IntelliJ Android Application
body: <p>I don't think this is an IntelliJ issue specifically but giving all the details regardless.  I created an Android Test Application in IntelliJ 13 and I'm trying to test some existing code in an Android application.  This bit of code accepts an InputStream which is a JSON file to be read.  I am trying to test a method for reading this file InputStream.  I have the following:</p>
  
  <p>My project structure looks like this:</p>
  
  <pre><code>android_test
  - libs
  - res
  - src
  - testAssetes
    - file.json
  </code></pre>
  
  <p>And my test method is:</p>
  
  <pre><code>public void testParseFile() {
    FileInputStream in = new FileInputStream(new File("./testAssets/file.json"));
    // code continues..
  }
  </code></pre>
  
  <p>I keep getting a FileNotFound exception.  I've also tried the following:</p>
  
  <pre><code>android_test
  - libs
  - res
  - src
    - com
      - test
        - file.json
  </code></pre>
  
  <p>And then my code is modified to:</p>
  
  <pre><code>InputStream in = getClass().getResourceAsStream("/com/test/file.json")
  </code></pre>
  
  <p>And in this case, the InputStream is always null.  I created a regular java project with similar code and it worked just fine. Not sure if it has something to do with how the InstrumentTestRunner is working or what the deal is.</p>
  
  <p>UPDATE: I just realized that the problem is probably because these tests are running with the InstrumentationTestRunner which executes on the emulator/device.  So I think what I need to know is how to get my test file on to that file system and read it in for a test.</p>