Search in sources :

Example 1 with ShadowConnectivityManager

use of org.robolectric.shadows.ShadowConnectivityManager in project OneSignal-Android-SDK by OneSignal.

the class MainOneSignalClassRunner method testOfflineCrashes.

@Test
public void testOfflineCrashes() throws Exception {
    ConnectivityManager connectivityManager = (ConnectivityManager) RuntimeEnvironment.application.getSystemService(Context.CONNECTIVITY_SERVICE);
    ShadowConnectivityManager shadowConnectivityManager = shadowOf(connectivityManager);
    shadowConnectivityManager.setActiveNetworkInfo(null);
    OneSignalInit();
    threadAndTaskWait();
    OneSignal.sendTag("key", "value");
    threadAndTaskWait();
    OneSignal.setSubscription(false);
    threadAndTaskWait();
}
Also used : ShadowConnectivityManager(org.robolectric.shadows.ShadowConnectivityManager) ConnectivityManager(android.net.ConnectivityManager) ShadowConnectivityManager(org.robolectric.shadows.ShadowConnectivityManager) Test(org.junit.Test)

Aggregations

ConnectivityManager (android.net.ConnectivityManager)1 Test (org.junit.Test)1 ShadowConnectivityManager (org.robolectric.shadows.ShadowConnectivityManager)1