lundi 22 juin 2015

Robolectric 3 : Load test specific resource

I'm using Robolectric 3 and I'm trying to load some resources that are in my test/res/ folder.

Here is my file hierarchy :

project/
|-src/
|--main/
|---AndroidManifest.xml
|---res/
|----raw/
|-----prod.json
|--test/
|---java/
|----com.app/
|-----CustomTestRunner.java
|-----Mytest.java
|---res/
|----raw/
|-----test.json

I would like in MyTest.java to do something like

RuntimeEnvironment.application.getResources().openRawResource(R.raw.test);

but i don't want to override all my "standard" res/ folder because i also need the prod.json file inside of my test.

Any idea of how to do such things ?

Thank you

Aucun commentaire:

Enregistrer un commentaire