### Question:
PhoneVerificationActivity extends AppCompatBase { @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; }  static Intent createIntent(Context context, FlowParameters flowParams, String phone); @Override void onBackPressed(); void submitConfirmationCode(String confirmationCode);  }### Answer:
@Test @Config(shadows = {BaseHelperShadow.class, ActivityHelperShadow.class}) public void testSubmitCode_badCodeShowsAlertDialog() { reset(BaseHelperShadow.sPhoneAuthProvider); when(ActivityHelperShadow.sFirebaseAuth.signInWithCredential(any(AuthCredential.class))) .thenReturn(new AutoCompleteTask<AuthResult>(null, true, new FirebaseAuthInvalidCredentialsException(ERROR_INVALID_VERIFICATION, "any_msg"))); testSendConfirmationCode(); SpacedEditText mConfirmationCodeEditText = (SpacedEditText) mActivity.findViewById(R.id .confirmation_code); Button mSubmitConfirmationButton = (Button) mActivity.findViewById(R.id .submit_confirmation_code); mConfirmationCodeEditText.setText("123456"); mSubmitConfirmationButton.performClick(); assertEquals(mActivity.getString(R.string.incorrect_code_dialog_body), getAlertDialogMessage()); android.support.v7.app.AlertDialog a = mActivity.getAlertDialog(); Button ok = (Button) a.findViewById(android.R.id.button1); ok.performClick(); assertEquals("- - - - - -", mConfirmationCodeEditText.getText().toString()); }