How to access files from assets folder during tests execution?
问题 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 assets : This is how I'm struggling to read the file: 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