public static void toast(Context context, @StringRes int message) {
    // this is a static method so it is easier to call,
    // as the context checking and casting is done for you

    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());
    }
  }
@Test
  public void testToastWithStringRes() {
    AppConfig.toast(ApplicationProvider.getApplicationContext(), R.string.ok);
    shadowOf(getMainLooper()).idle();
    await().atMost(5, TimeUnit.SECONDS).until(() -> ShadowToast.getLatestToast() != null);
    assertEquals(
        ApplicationProvider.getApplicationContext().getString(R.string.ok),
        ShadowToast.getTextOfLatestToast());
  }