@Test
  public void testOptionsMenuSwitchUiModeOnLightMode() {
    accountDb.add(
        "first", "7777777777777777", OtpType.HOTP, null, null, AccountDb.GOOGLE_ISSUER_NAME);
    Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();

    activityTestRule.launchActivity(null);

    assertThat(activityTestRule.getActivity().darkModeEnabled).isFalse();
    onView(isRoot()).perform(pressMenuKey());
    onView(withText(context.getString(R.string.switch_ui_mode_dark))).perform(click());
    onView(isRoot()).perform(pressMenuKey());
    onView(withText(context.getString(R.string.switch_ui_mode_light)))
        .check(matches(isDisplayed()));
    assertThat(activityTestRule.getActivity().darkModeEnabled).isTrue();
  }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java