Why in a test class that extends AndroidTestCase, does getContext() return null?
问题 I have my own SQLiteOpenHelper as follow : public class MyOpenHelper extends SQLiteOpenHelper { public static final int DB_VERSION = 1; public static final String DB_NAME = "dbname"; public MyOpenHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { /* My create code */ } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) { /* My upgrade code */ } @Override public void