private static void invokePreferencePerformClick(
      Preference preference, PreferenceScreen preferenceScreen) {
    try {
      Method performClickMethod =
          Preference.class.getDeclaredMethod("performClick", PreferenceScreen.class);
      performClickMethod.setAccessible(true);
      performClickMethod.invoke(preference, preferenceScreen);
    } catch (NoSuchMethodException e) {
      throw new RuntimeException("Preference.performClickMethod method not found", e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException("Preference.performClickMethod failed", e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException("Failed to access Preference.performClickMethod", e);
    }
  }
Taps the specified preference displayed by the provided Activity.
javatests/com/google/android/apps/authenticator/testing/TestUtilities.java