Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get asset on test package with ServiceTestCase. (Android)
import android.content.Context;
import android.content.res.AssetManager;
import android.test.ServiceTestCase;
public class HogeTest extends ServiceTestCase<HogeService>
private Context getTestContext() throws Exception
return (Context)getClass().getMethod("getTestContext").invoke(this);
public void testHoge() throws Exception
AssetManager am = getTestContext().getResources().getAssets(); is ="hoge.txt");
try {
// hogehoge
finally {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.