AnalysisFragmentImpl extends AnalysisScreenContract.View { @Override void showAlertDialog(@NonNull final String message, @NonNull final String positiveButtonTitle, @NonNull final DialogInterface.OnClickListener positiveButtonClickListener, @Nullable final String negativeButtonTitle, @Nullable final DialogInterface.OnClickListener negativeButtonClickListener, @Nullable final DialogInterface.OnCancelListener cancelListener) { mFragment.showAlertDialog(message, positiveButtonTitle, positiveButtonClickListener, negativeButtonTitle, negativeButtonClickListener, cancelListener); } AnalysisFragmentImpl(final FragmentImplCallback fragment,
            @NonNull final Document document,
            final String documentAnalysisErrorMessage); @Override void hideError(); @Override void onNoExtractionsFound(); @Override void onDocumentAnalyzed(); @Override void showError(@NonNull final String message, final int duration); @Override void showError(@NonNull final String message, @NonNull final String buttonTitle,
            @NonNull final View.OnClickListener onClickListener); @Override void startScanAnimation(); @Override void stopScanAnimation(); @Override void setListener(@NonNull final AnalysisFragmentListener listener); void onCreate(final Bundle savedInstanceState); View onCreateView(final LayoutInflater inflater, final ViewGroup container,
            final Bundle savedInstanceState); void onStart(); void onDestroy();  }
@Test public void should_showAlertDialog() throws Exception { final AtomicReference<AnalysisFragmentImpl> analysisFragmentImplRef = new AtomicReference<>(); try (final ActivityScenario<AnalysisFragmentHostActivity> scenario = launchHostActivity( analysisFragmentImplRef)) { scenario.onActivity( new ActivityScenario.ActivityAction<AnalysisFragmentHostActivity>() { @Override public void perform(final AnalysisFragmentHostActivity activity) { final AnalysisFragmentImpl analysisFragment = analysisFragmentImplRef.get(); analysisFragment.showAlertDialog("Message", "PositiveButtonTitle", mock(DialogInterface.OnClickListener.class), "NegativeButtonTitle", mock(DialogInterface.OnClickListener.class), mock(DialogInterface.OnCancelListener.class)); } }); assertThat(DialogShadow.showCalled).isTrue(); } }