### Question:
PreferencesProvider { public synchronized void saveRegistrationId(@Nullable final String registrationId) { OPFLog.logMethod(); updateAppVersion(); if (registrationId == null) { preferences.remove(KEY_REGISTRATION_ID); } else { preferences.put(KEY_REGISTRATION_ID, registrationId); } } private  PreferencesProvider(@NonNull final Context context); @SuppressWarnings("PMD.NonThreadSafeSingleton") @NonNull static PreferencesProvider getInstance(@NonNull final Context context); @Nullable synchronized String getRegistrationId(); synchronized void saveRegistrationId(@Nullable final String registrationId); synchronized boolean isAuthenticationFailed(); synchronized void saveAuthenticationFailedFlag(); synchronized void removeAuthenticationFailedFlag(); synchronized void reset(); static final int NO_SAVED_APP_VERSION; }### Answer:
@Test public void testSaveRegistrationId() { String expected; for (int i = 0; i < NUM_TESTS; ++i) { expected = String.format("id%d", i); preferencesProvider.saveRegistrationId(expected); assertEquals(expected, preferences.getString(KEY_REGISTRATION_ID)); } preferencesProvider.saveRegistrationId(null); assertFalse(preferences.contains(KEY_REGISTRATION_ID)); }