use of com.onesignal.OSDeviceState in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method testDeviceStateHasSMSAddress.
@Test
public void testDeviceStateHasSMSAddress() throws Exception {
assertNull(OneSignal.getDeviceState());
OneSignalInit();
threadAndTaskWait();
OSDeviceState device = OneSignal.getDeviceState();
assertNull(device.getSMSNumber());
OneSignal.setSMSNumber(ONESIGNAL_SMS_NUMBER);
threadAndTaskWait();
// Device is a snapshot, last value should not change
assertNull(device.getSMSNumber());
// Retrieve new user device
assertEquals(ONESIGNAL_SMS_NUMBER, OneSignal.getDeviceState().getSMSNumber());
}
use of com.onesignal.OSDeviceState in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method testDeviceStateHasEmailAddress.
@Test
public void testDeviceStateHasEmailAddress() throws Exception {
String testEmail = "test@onesignal.com";
assertNull(OneSignal.getDeviceState());
OneSignalInit();
threadAndTaskWait();
OSDeviceState device = OneSignal.getDeviceState();
assertNull(device.getEmailAddress());
OneSignal.setEmail(testEmail);
threadAndTaskWait();
// Device is a snapshot, last value should not change
assertNull(device.getEmailAddress());
// Retrieve new user device
assertEquals(testEmail, OneSignal.getDeviceState().getEmailAddress());
}
use of com.onesignal.OSDeviceState in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method shouldGetEmailUserIdAfterAppRestart.
@Test
public void shouldGetEmailUserIdAfterAppRestart() throws Exception {
OneSignalInit();
OneSignal.setEmail("josh@onesignal.com");
threadAndTaskWait();
restartAppAndElapseTimeToNextSession(time);
OneSignalInit();
OSDeviceState deviceState = OneSignal.getDeviceState();
assertEquals("josh@onesignal.com", deviceState.getEmailAddress());
assertNotNull(deviceState.getEmailUserId());
}
use of com.onesignal.OSDeviceState in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method shouldReturnCorrectGetPermissionSubscriptionState.
@Test
public void shouldReturnCorrectGetPermissionSubscriptionState() throws Exception {
OneSignalInit();
threadAndTaskWait();
OSDeviceState deviceState = OneSignal.getDeviceState();
assertTrue(deviceState.areNotificationsEnabled());
assertTrue(deviceState.isSubscribed());
}
use of com.onesignal.OSDeviceState in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method testDeviceStateHasSMSId.
@Test
public void testDeviceStateHasSMSId() throws Exception {
assertNull(OneSignal.getDeviceState());
OneSignalInit();
threadAndTaskWait();
OSDeviceState device = OneSignal.getDeviceState();
assertNull(device.getSMSUserId());
OneSignal.setSMSNumber(ONESIGNAL_SMS_NUMBER);
threadAndTaskWait();
// Device is a snapshot, last value should not change
assertNull(device.getSMSUserId());
// Retrieve new user device
assertEquals(SMS_USER_ID, OneSignal.getDeviceState().getSMSUserId());
}
Aggregations