### Question:
DataCollectionHelper { public void setAutomaticDataCollectionEnabled(boolean isEnabled) { sharedPreferencesUtils.setBooleanPreference(AUTO_INIT_PREFERENCES, isEnabled); } @Inject  DataCollectionHelper(
      FirebaseApp firebaseApp,
      SharedPreferencesUtils sharedPreferencesUtils,
      Subscriber firebaseEventsSubscriber); boolean isAutomaticDataCollectionEnabled(); void setAutomaticDataCollectionEnabled(boolean isEnabled); void setAutomaticDataCollectionEnabled(Boolean isEnabled);  }### Answer:
@Test public void setAutomaticDataCollectionEnabled_updatesSharedPreferences() { when(sharedPreferencesUtils.isPreferenceSet(DataCollectionHelper.AUTO_INIT_PREFERENCES)) .thenReturn(false); when(sharedPreferencesUtils.isManifestSet( DataCollectionHelper.MANIFEST_METADATA_AUTO_INIT_ENABLED)) .thenReturn(false); when(firebaseApp.isDataCollectionDefaultEnabled()).thenReturn(true); dataCollectionHelper = new DataCollectionHelper(firebaseApp, sharedPreferencesUtils, subscriber); dataCollectionHelper.setAutomaticDataCollectionEnabled(Boolean.FALSE); verify(sharedPreferencesUtils, times(1)) .setBooleanPreference(DataCollectionHelper.AUTO_INIT_PREFERENCES, false); dataCollectionHelper.setAutomaticDataCollectionEnabled(null); verify(sharedPreferencesUtils, times(1)) .clearPreference(DataCollectionHelper.AUTO_INIT_PREFERENCES); }