EmailActivity extends AppCompatBase implements CheckEmailFragment.CheckEmailListener,
        RegisterEmailFragment.AnonymousUpgradeListener, EmailLinkFragment
                .TroubleSigningInListener, TroubleSigningInFragment.ResendEmailListener { @Override public void onNewUser(User user) { TextInputLayout emailLayout = findViewById(R.id.email_layout); AuthUI.IdpConfig emailConfig = ProviderUtils.getConfigFromIdps(getFlowParams().providers, EmailAuthProvider.PROVIDER_ID); if (emailConfig == null) { emailConfig = ProviderUtils.getConfigFromIdps(getFlowParams().providers, EMAIL_LINK_PROVIDER); } if (emailConfig.getParams().getBoolean(ExtraConstants.ALLOW_NEW_EMAILS, true)) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); if (emailConfig.getProviderId().equals(EMAIL_LINK_PROVIDER)) { showRegisterEmailLinkFragment(emailConfig, user.getEmail()); } else { RegisterEmailFragment fragment = RegisterEmailFragment.newInstance(user); ft.replace(R.id.fragment_register_email, fragment, RegisterEmailFragment.TAG); if (emailLayout != null) { String emailFieldName = getString(R.string.fui_email_field_name); ViewCompat.setTransitionName(emailLayout, emailFieldName); ft.addSharedElement(emailLayout, emailFieldName); } ft.disallowAddToBackStack().commit(); } } else { emailLayout.setError(getString(R.string.fui_error_email_does_not_exist)); } }  static Intent createIntent(Context context, FlowParameters flowParams); static Intent createIntent(Context context, FlowParameters flowParams, String email); static Intent createIntentForLinking(Context context, FlowParameters flowParams,
                                                IdpResponse responseForLinking); @Override void onExistingEmailUser(User user); @Override void onExistingIdpUser(User user); @Override void onNewUser(User user); @Override void onTroubleSigningIn(String email); @Override void onClickResendEmail(String email); @Override void onSendEmailFailure(Exception e); @Override void onDeveloperFailure(Exception e); @Override void showProgress(@StringRes int message); @Override void hideProgress(); @Override void onMergeFailure(IdpResponse response);  }
@Test public void testSignUpButton_validatesFields() { EmailActivity emailActivity = createActivity(EmailAuthProvider.PROVIDER_ID); emailActivity.onNewUser( new User.Builder(EmailAuthProvider.PROVIDER_ID, TestConstants.EMAIL).build()); Button button = emailActivity.findViewById(R.id.button_create); button.performClick(); TextInputLayout nameLayout = emailActivity.findViewById(R.id.name_layout); TextInputLayout passwordLayout = emailActivity.findViewById(R.id.password_layout); assertEquals( emailActivity.getString(R.string.fui_missing_first_and_last_name), nameLayout.getError().toString()); assertEquals( String.format( emailActivity.getResources().getQuantityString( R.plurals.fui_error_weak_password, R.integer.fui_min_password_length), emailActivity.getResources() .getInteger(R.integer.fui_min_password_length) ), passwordLayout.getError().toString()); }