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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -