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

how to do line continuation in perl debugger for entering raw multi-line text (EOT)? -

android - Linear layout children not scrolling -

javascript - Create websocket without connecting -