I have the following code:
public class MyClass {
private static URL url;
@BeforeClass
public static void init() throws Exception {
url = MyClass.class.getResource("myjs.js");
}
@Test
public void someTest() {
// test code here using url
}
}
The package for my class is com.mypackage
File myjs.js is also there at the same place alongside MyClass.
The test runs fine in Eclipse as a JUnit.
But when I try to execute the same using gradle:
./gradlew :MyModule:test --tests 'MyClass*'
It fails with url being null.
Why gradle is not being able to read resource myjs.js correctly?
The build folder has test_classes where if I go to com.mypackage, I can see both MyClass.class file and myjs.js file.
What am I missing?
Aucun commentaire:
Enregistrer un commentaire