Accessing context.getFilesDir() from InstrumentationTestCase
05 March 2016 on Android.
In order to fix getting null value problem while using Context.getFilesDir() inside InstrumentationTestCase,you need to create files
directorory.
adb shell
cd /data/data/package_id_of_app
mkdir files
Now following test assertion codes will not fail.
assertNotNull(getInstrumentation().getContext().getFilesDir());
assertNotNull(getInstrumentation().getContext().openFileInput("aa.db"));