17
17
18
18
package it .feio .android .omninotes ;
19
19
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 ;
21
26
22
- import android .Manifest ;
23
27
import android .content .Context ;
24
28
import android .content .SharedPreferences ;
25
- import androidx .test .core .app .ApplicationProvider ;
29
+ import androidx .test .platform .app .InstrumentationRegistry ;
26
30
import androidx .test .rule .GrantPermissionRule ;
27
31
import it .feio .android .omninotes .db .DbHelper ;
32
+ import it .feio .android .omninotes .helpers .LanguageHelper ;
28
33
import it .feio .android .omninotes .utils .Constants ;
29
34
import org .junit .AfterClass ;
30
35
import org .junit .BeforeClass ;
@@ -42,22 +47,20 @@ public class BaseAndroidTestCase {
42
47
43
48
@ Rule
44
49
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
49
51
);
50
52
51
53
@ BeforeClass
52
54
public static void setUpBeforeClass () {
53
- testContext = ApplicationProvider . getApplicationContext ();
55
+ testContext = InstrumentationRegistry . getInstrumentation (). getTargetContext ();
54
56
prefs = testContext .getSharedPreferences (Constants .PREFS_NAME , Context .MODE_MULTI_PROCESS );
55
57
dbHelper = DbHelper .getInstance (testContext );
56
58
prefs = testContext .getSharedPreferences (Constants .PREFS_NAME , Context .MODE_PRIVATE );
57
59
// assertTrue("Database used for tests MUST not be the default one but prefixed by '" + DB_PREFIX + "'", dbHelper
58
60
// .getDatabase().getPath().matches(DB_PATH_REGEX));
59
61
// assertFalse("Database MUST be writable", dbHelper.getDatabase(true).isReadOnly());
60
62
// cleanDatabase();
63
+ LanguageHelper .updateLanguage (testContext , ENGLISH .toString ());
61
64
}
62
65
63
66
@ AfterClass
0 commit comments