java - get local android test resources -


when running standard junit tests (not androidtestcase) in android, how can resources in src/test/resources?

i have tried usual...

getclass().getresourceasstream("/testdata.dat");

and...

thread.currentthread().getcontextclassloader() .getresourceasstream("/testdata.dat");

and gradle copy resources..

task copytestresources(type: copy) { "${projectdir}/src/test/resources" "${builddir}/classes/test" }

what confuses me when ask in unit test classloaders path getting resources using

classloader classloader = thread.currentthread().getcontextclassloader(); url resource = classloader.getresource(".");

it returns: /home/rob/android/sdk/platforms/android-17/data/res

can please explain me , tell me how can relative path anywhere in project can use test resources?


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -