### Question:
PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } }  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 testresendCode_invokesUpstream() { reset(BaseHelperShadow.sPhoneAuthProvider); testSendConfirmationCode(); TextView r = (TextView) mActivity.findViewById(R.id.resend_code); assertEquals(View.GONE, r.getVisibility()); SubmitConfirmationCodeFragment fragment = (SubmitConfirmationCodeFragment) mActivity .getSupportFragmentManager().findFragmentByTag(SubmitConfirmationCodeFragment.TAG); fragment.getmCountdownTimer().onFinish(); assertEquals(View.VISIBLE, r.getVisibility()); r.performClick(); assertEquals(View.GONE, r.getVisibility()); verify(ActivityHelperShadow.sPhoneAuthProvider).verifyPhoneNumber(eq(PHONE), eq (AUTO_RETRIEVAL_TIMEOUT_MILLIS), eq(TimeUnit.MILLISECONDS), eq(mActivity), callbacksArgumentCaptor.capture(), eq(forceResendingToken)); }
@Test @Config(shadows = {BaseHelperShadow.class, ActivityHelperShadow.class}) public void testAutoVerify() { reset(BaseHelperShadow.sPhoneAuthProvider); reset(BaseHelperShadow.sSaveSmartLock); reset(BaseHelperShadow.sFirebaseAuth); when(BaseHelperShadow.sFirebaseUser.getPhoneNumber()).thenReturn(PHONE); when(BaseHelperShadow.sFirebaseUser.getEmail()).thenReturn(null); when(ActivityHelperShadow.sFirebaseAuth.signInWithCredential(any(AuthCredential.class))) .thenReturn(new AutoCompleteTask(FakeAuthResult.INSTANCE , true, null)); mActivity.verifyPhoneNumber(PHONE, false); verify(ActivityHelperShadow.sPhoneAuthProvider).verifyPhoneNumber(eq(PHONE), eq (AUTO_RETRIEVAL_TIMEOUT_MILLIS), eq(TimeUnit.MILLISECONDS), eq(mActivity), callbacksArgumentCaptor.capture(), isNull(PhoneAuthProvider.ForceResendingToken .class)); PhoneAuthProvider.OnVerificationStateChangedCallbacks onVerificationStateChangedCallbacks = callbacksArgumentCaptor.getValue(); onVerificationStateChangedCallbacks.onVerificationCompleted(credential); verify(ActivityHelperShadow.sFirebaseAuth).signInWithCredential(any(AuthCredential.class)); }