title: What broke my getResourceAsStream?
body: <p>I'm taking over a project and have to assume that the tests worked at some point the way I find them (boiled down to what should not be null):</p>
  
  <pre><code>@Test
  public void testCoding() {
     assertNotNull(getClass().getResourceAsStream("/myfile.json"));
     //assertNotNull(MyTest.class.getResourceAsStream("/myfile.json"));
     //assertNotNull(MyTest.class.getClassLoader().getResourceAsStream("myfile.json"));
     //...
  }
  </code></pre>
  
  <p>with <code>myfile.json</code> in <code>src/test/resources/</code> and the test in <code>src/test/java/some/package/</code>.</p>
  
  <p>I tried putting <code>myfile.json</code> into the same folder as the test, in the src/java folder, I tried with and without leading <code>/</code> and with <code>/resources</code> and all the tips I found on SO.</p>
  
  <p>The gradle file is:</p>
  
  <pre><code>    apply plugin: 'java'
  
      repositories {
          mavenCentral()
      }
  
      dependencies {
          testCompile "junit:junit:$junitVersion"
      }
  </code></pre>
  
  <p>What am I missing?</p>
  
  <hr>
  
  <p>Update:</p>
  
  <p>I realized that the source code is in the open source part of our project and that it does fail in AS, only.</p>
  
  <p><a href="https://github.com/mycelium-com/wallet/blob/master/lt-api/src/test/java/com/mycelium/lt/location/GoogleMapsGeocoderTest.java#L45" rel="nofollow noreferrer">Here is the line that fails</a> if I right-click the <code>lt-api/src/test/java/</code> folder and select "Run All Tests". The Gradle console prints out this line:</p>
  
  <pre><code>    Executing tasks: [:lt-api:compileJava, :lt-api:testClasses, :mbwlib:compileJava, :mbwlib:testClasses, :bitlib:compileJava, :bitlib:testClasses]
  </code></pre>
  
  <p>Running
          ./gradlew clean :lt-api:compileJava :lt-api:testClasses :mbwlib:compileJava :mbwlib:testClasses :bitlib:compileJava :bitlib:testClasses</p>
  
  <p>does not trigger the error but neither does it run tests. (How can I know what exactly AS is doing there? I thought AS was doing gradle all the way now?)</p>
  
  <p>Running</p>
  
  <pre><code>    ./gradlew clean :lt-api:test
  </code></pre>
  
  <p>I get the tests to run (adding a typo results in failing tests) but it doesn't trigger the issue I originally had and that I'd like to understand.</p>
  
  <p>Where should the file be?</p>
  
  <pre><code>$ sudo updatedb
  $ locate test-classes
  $ locate ungargasse.json
  /path/to/project/lt-api/build/resources/test/ungargasse.json
  /path/to/project/lt-api/src/test/resources/ungargasse.json
  </code></pre>