@Test
  public void testOptionsMenuSwitchUiModeHidedInBeginSetupScreenOnDarkMode() {
    Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
    setDarkModeEnabled(context, true);

    activityTestRule.launchActivity(null);

    onView(isRoot()).perform(pressMenuKey());
    try {
      onView(withText(context.getString(R.string.switch_ui_mode_light))).perform(click());
      Assert.fail("Switch UI mode option should be hidden in begin setup screen");
    } catch (NoMatchingViewException ignored) {
      // Expected.
    }
  }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java