I'm writing JUnit test code for an android service implementation, and I have to initialize the tests with some files copied on sdcard. My class signature is like this:
public class ImageServiceTest extends ServiceTestCase<ImageService>
I'm trying to use this tip to copy the files from assets, but the getAssets() method needs to extends Activity class.
public void copyAssets() {
AssetManager assetManager = getAssets();
...
}
So.. How I can copy files from assets to sdcard to setUp the junit test in android?
Thanks in advanced.
Ps:
'getSystemContext().getAssets();', 'getContext().getAssets();', 'getApplicationContext();' returns the Service Project context, not the test project context.
Now i'm trying to use Instrumentation, however it demands an Activity and I'm working with a Service project. I'm looking how to use Instrumentation without an Activity...