1717
1818package it .feio .android .omninotes ;
1919
20- import static org .junit .Assert .assertFalse ;
20+ import static android .Manifest .permission .ACCESS_COARSE_LOCATION ;
21+ import static android .Manifest .permission .ACCESS_FINE_LOCATION ;
22+ import static android .Manifest .permission .READ_EXTERNAL_STORAGE ;
23+ import static android .Manifest .permission .RECORD_AUDIO ;
24+ import static android .Manifest .permission .WRITE_EXTERNAL_STORAGE ;
25+ import static java .util .Locale .ENGLISH ;
2126
22- import android .Manifest ;
2327import android .content .Context ;
2428import android .content .SharedPreferences ;
25- import androidx .test .core .app .ApplicationProvider ;
29+ import androidx .test .platform .app .InstrumentationRegistry ;
2630import androidx .test .rule .GrantPermissionRule ;
2731import it .feio .android .omninotes .db .DbHelper ;
32+ import it .feio .android .omninotes .helpers .LanguageHelper ;
2833import it .feio .android .omninotes .utils .Constants ;
2934import org .junit .AfterClass ;
3035import org .junit .BeforeClass ;
@@ -42,22 +47,20 @@ public class BaseAndroidTestCase {
4247
4348 @ Rule
4449 public GrantPermissionRule permissionRule = GrantPermissionRule .grant (
45- Manifest .permission .ACCESS_COARSE_LOCATION ,
46- Manifest .permission .READ_EXTERNAL_STORAGE ,
47- Manifest .permission .WRITE_EXTERNAL_STORAGE ,
48- Manifest .permission .RECORD_AUDIO
50+ ACCESS_COARSE_LOCATION , ACCESS_FINE_LOCATION , READ_EXTERNAL_STORAGE , WRITE_EXTERNAL_STORAGE , RECORD_AUDIO
4951 );
5052
5153 @ BeforeClass
5254 public static void setUpBeforeClass () {
53- testContext = ApplicationProvider . getApplicationContext ();
55+ testContext = InstrumentationRegistry . getInstrumentation (). getTargetContext ();
5456 prefs = testContext .getSharedPreferences (Constants .PREFS_NAME , Context .MODE_MULTI_PROCESS );
5557 dbHelper = DbHelper .getInstance (testContext );
5658 prefs = testContext .getSharedPreferences (Constants .PREFS_NAME , Context .MODE_PRIVATE );
5759// assertTrue("Database used for tests MUST not be the default one but prefixed by '" + DB_PREFIX + "'", dbHelper
5860// .getDatabase().getPath().matches(DB_PATH_REGEX));
5961// assertFalse("Database MUST be writable", dbHelper.getDatabase(true).isReadOnly());
6062// cleanDatabase();
63+ LanguageHelper .updateLanguage (testContext , ENGLISH .toString ());
6164 }
6265
6366 @ AfterClass
0 commit comments