### Question:
Settings { public synchronized void saveLastProvider(@Nullable final PushProvider provider) { OPFLog.logMethod(provider); if (provider == null) { preferences.remove(KEY_LAST_PROVIDER_NAME); } else { preferences.put(KEY_LAST_PROVIDER_NAME, provider.getName()); } } private  Settings(@NonNull final Context context); @SuppressWarnings("PMD.NonThreadSafeSingleton") static Settings getInstance(@NonNull final Context context); @NonNull synchronized State getState(); synchronized void saveState(@NonNull final State state); synchronized void clear(); @Nullable synchronized String getLastProviderName(); synchronized void saveLastProvider(@Nullable final PushProvider provider); @Nullable synchronized String getLastAndroidId(); synchronized void saveLastAndroidId(@Nullable final String androidId); synchronized void saveUnregisteringProvider(@NonNull final String providerName); synchronized void removeUnregisteringProvider(@NonNull final String providerName); synchronized boolean isProviderUnregistrationPerforming(@NonNull final String providerName); synchronized void saveRegisteringProvider(@NonNull final String providerName); synchronized void removeRegisteringProvider(@NonNull final String providerName); synchronized boolean isProviderRegistrationPerforming(@NonNull final String providerName); synchronized void savePendingRegistrationProvider(@NonNull final String providerName); synchronized void removePendingRegistrationProvider(); @Nullable synchronized String getPendingRegistrationProvider(); synchronized void savePendingUnregistrationProvider(@NonNull final String providerName); synchronized void removePendingUnregistrationProvider(); @Nullable synchronized String getPendingUnregistrationProvider();  }### Answer:
@Test public void saveLastProviderName() { PushProvider expected; for (int i = 0; i < NUM_TESTS; ++i) { expected = pushProviders[RND.nextInt(NUM_PROVIDERS)]; settings.saveLastProvider(expected); assertEquals(expected.getName(), sharedPreferences.getString(KEY_LAST_PROVIDER_NAME, null)); } }
@Test public void saveLastProviderNameNullCase() { settings.saveLastProvider(pushProviders[RND.nextInt(NUM_PROVIDERS)]); settings.saveLastProvider(null); assertFalse(sharedPreferences.contains(KEY_LAST_PROVIDER_NAME)); }