TokenRegistry implements InvalidClientIdHandler, InternalRegistrationProgressListener { @Override public void onSuccessfulRegistration(String clientId, Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); preferences.edit().putString(sharedPreferencesKey(appKey), clientId).apply(); } TokenRegistry(String appKey, RegistrationListenerStack listenerStack, Context context, PlatformType platformType, PusherAndroidOptions options, PusherAndroidFactory factory); void receive(String token); @Override void onInvalidClientId(StringEntity params); @Override void onSuccessfulRegistration(String clientId, Context context); @Override void onFailedRegistration(int statusCode, String reason);  }
@Test public void onSuccessfulRegistrationSavesClientId() throws Exception { tokenRegistry.onSuccessfulRegistration("new-client-id", context); String cachedId = PreferenceManager. getDefaultSharedPreferences(context) .getString("__pusher__client__key__fcm__superkey", null); assertEquals("new-client-id", cachedId); }