urbanairship-core/src/test/java/com/urbanairship/push/PushManagerTest.java
@Test
    public void testMigrateGcmRegistrationTokenSettings() {
        TestApplication.getApplication().setPlatform(UAirship.ANDROID_PLATFORM);

        // Initialize the GCM instance ID token
        preferenceDataStore.put(PushManager.REGISTRATION_TOKEN_MIGRATED_KEY, false);
        preferenceDataStore.put(PushManager.GCM_INSTANCE_ID_TOKEN_KEY, "gcmIdToken");

        // Verify that registration token has not been set
        assertNull(preferenceDataStore.getString(PushManager.REGISTRATION_TOKEN_KEY, null));

        // Migrate the GCM instance ID token
        pushManager.migrateRegistrationTokenSettings();

        // Verify that the token has been migrated to the new setting
        assertEquals("gcmIdToken", preferenceDataStore.getString(PushManager.REGISTRATION_TOKEN_KEY, null));
        assertTrue(preferenceDataStore.getBoolean(PushManager.REGISTRATION_TOKEN_MIGRATED_KEY, false));
    }
/**
     * Test migrating the GCM instance ID setting to the registration token setting.
     */
Test migrating the GCM instance ID setting to the registration token setting.
Test migrating the GCM instance ID setting to the registration token setting .
@Test
    public void testMigrateGcmRegistrationTokenSettings() {
        TestApplication.getApplication().setPlatform(UAirship.ANDROID_PLATFORM);
        preferenceDataStore.put(PushManager.REGISTRATION_TOKEN_MIGRATED_KEY, false);
        preferenceDataStore.put(PushManager.GCM_INSTANCE_ID_TOKEN_KEY, "gcmIdToken");
        assertNull(preferenceDataStore.getString(PushManager.REGISTRATION_TOKEN_KEY, null));
        pushManager.migrateRegistrationTokenSettings();
        assertEquals("gcmIdToken", preferenceDataStore.getString(PushManager.REGISTRATION_TOKEN_KEY, null));
        assertTrue(preferenceDataStore.getBoolean(PushManager.REGISTRATION_TOKEN_MIGRATED_KEY, false));
    }
@ Test public void testMigrateGcmRegistrationTokenSettings ( ) { TestApplication . getApplication ( ) . setPlatform ( UAirship . ANDROID_PLATFORM ) ; preferenceDataStore . put ( PushManager . REGISTRATION_TOKEN_MIGRATED_KEY , false ) ; preferenceDataStore . put ( PushManager . GCM_INSTANCE_ID_TOKEN_KEY , "gcmIdToken" ) ; assertNull ( preferenceDataStore . getString ( PushManager . REGISTRATION_TOKEN_KEY , null ) ) ; pushManager . migrateRegistrationTokenSettings ( ) ; assertEquals ( "gcmIdToken" , preferenceDataStore . getString ( PushManager . REGISTRATION_TOKEN_KEY , null ) ) ; assertTrue ( preferenceDataStore . getBoolean ( PushManager . REGISTRATION_TOKEN_MIGRATED_KEY , false ) ) ; }
Test migrating the GCM instance ID setting to the registration token setting.
Test migrating the GCM instance ID setting to the registration token setting .
// Initialize the GCM instance ID token // Verify that registration token has not been set // Migrate the GCM instance ID token // Verify that the token has been migrated to the new setting