GlucosioApplication extends Application { @Override public void onCreate() { super.onCreate(); sInstance = this; initFont(); initLanguage(); }  @Override void onCreate(); @NonNull Backup getBackup(); @NonNull Analytics getAnalytics(); @NonNull DatabaseHandler getDBHandler(); @NonNull A1CCalculatorPresenter createA1cCalculatorPresenter(@NonNull final A1cCalculatorActivity activity); @NonNull LocaleHelper getLocaleHelper(); @NonNull Preferences getPreferences(); static GlucosioApplication getInstance(); @NonNull HelloPresenter createHelloPresenter(@NonNull final HelloActivity activity);  }
@Test public void ShouldClearLanguage_WhenSetFromHelloActivityAndNotFixedYet() { when(databaseHandlerMock.getUser(1)).thenReturn(user); application.onCreate(); verify(databaseHandlerMock).updateUser(userCaptor.capture()); assertThat(userCaptor.getValue().getPreferred_language()).isNull(); }
@Test public void ShouldSaveLanguageClearedToPreferences_WhenItIsDone() { when(databaseHandlerMock.getUser(1)).thenReturn(user); application.onCreate(); verify(preferencesMock).saveLocaleCleaned(); }
@Test public void ShouldNotClearLanguage_WhenAlreadyDone() { user.setPreferred_language("en"); application.onCreate(); assertThat(user.getPreferred_language()).isNotNull(); verify(databaseHandlerMock, never()).updateUser(user); }