### Question:
AppConfig extends GlideApplication { public static void toast(Context context, @StringRes int message) { if (context == null) return; if (!(context instanceof Application)) { context = context.getApplicationContext(); } if (context instanceof Application) { final Context c = context; final @StringRes int m = message; getInstance().runInApplicationThread(() -> Toast.makeText(c, m, Toast.LENGTH_LONG).show()); } }  UtilitiesProvider getUtilsProvider(); @Override void onCreate(); @Override void onTerminate(); void runInBackground(Runnable runnable); static void toast(Context context, @StringRes int message); static void toast(Context context, String message); void runInApplicationThread(Runnable r); static synchronized AppConfig getInstance(); ImageLoader getImageLoader(); UtilsHandler getUtilsHandler(); void setMainActivityContext(@NonNull Activity activity); ScreenUtils getScreenUtils(); @Nullable Context getMainActivityContext(); ExplorerDatabase getExplorerDatabase(); UtilitiesDatabase getUtilitiesDatabase(); static final String TAG; }### Answer:
@Test public void testToastWithNullContext() { AppConfig.toast(null, R.string.ok); assertNull(ShadowToast.getLatestToast()); }
@Test public void testToastWithStringRes() { AppConfig.toast(ApplicationProvider.getApplicationContext(), R.string.ok); await().atMost(5, TimeUnit.SECONDS).until(() -> ShadowToast.getLatestToast() != null); assertEquals( ApplicationProvider.getApplicationContext().getString(R.string.ok), ShadowToast.getTextOfLatestToast()); }
@Test public void testToastWithString() { AppConfig.toast(ApplicationProvider.getApplicationContext(), "Hello world"); await().atMost(5, TimeUnit.SECONDS).until(() -> ShadowToast.getLatestToast() != null); assertEquals("Hello world", ShadowToast.getTextOfLatestToast()); }