29
29
import android .os .Build .VERSION_CODES ;
30
30
import androidx .test .core .app .ApplicationProvider ;
31
31
import org .junit .Test ;
32
+ import org .junit .Before ;
32
33
import org .junit .runner .RunWith ;
33
34
import org .robolectric .RobolectricTestRunner ;
34
35
import org .robolectric .annotation .Config ;
38
39
@ Config (minSdk = VERSION_CODES .Q )
39
40
public class PermissionsHelperTest {
40
41
41
- private static final ComponentName TESTDPC_ADMIN =
42
- new ComponentName ("com.afwsamples.testdpc" , "TestCls" );
43
- private static final ComponentName NON_TESTDPC_ADMIN = new ComponentName ("TestPkg" , "TestCls" );
42
+ private ComponentName TESTDPC_ADMIN = null ;
43
+ private ComponentName NON_TESTDPC_ADMIN = null ;
44
44
45
45
private final Context mContext = ApplicationProvider .getApplicationContext ();
46
46
private final DevicePolicyManager mDevicePolicyManager =
@@ -53,6 +53,12 @@ public class PermissionsHelperTest {
53
53
private static final String NORMAL_PERMISSION = permission .ACCESS_WIFI_STATE ;
54
54
private static final String MISSING_INFO_PERMISSION = permission .CHANGE_WIFI_STATE ;
55
55
56
+ @ Before
57
+ public void initialize () {
58
+ TESTDPC_ADMIN = new ComponentName ("com.afwsamples.testdpc" , "TestCls" );
59
+ NON_TESTDPC_ADMIN = new ComponentName ("TestPkg" , "TestCls" );
60
+ }
61
+
56
62
@ Test
57
63
public void
58
64
ensureRequiredPermissions_ifPermissionMissingFromManifest_shouldReturnFalseAndLogError () {
0 commit comments