AnalysisFragmentImpl extends AnalysisScreenContract.View { @Override Size getPdfPreviewSize() { return new Size(mImageDocumentView.getWidth(), mImageDocumentView.getHeight()); } 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_getSize_forPdfPreview() throws Exception { final AtomicReference<AnalysisFragmentImpl> analysisFragmentImplRef = new AtomicReference<>(); final AtomicReference<Size> pdfPreviewSize; try (final ActivityScenario<AnalysisFragmentHostActivity> scenario = launchHostActivity( analysisFragmentImplRef)) { pdfPreviewSize = new AtomicReference<>(); scenario.onActivity( new ActivityScenario.ActivityAction<AnalysisFragmentHostActivity>() { @Override public void perform(final AnalysisFragmentHostActivity activity) { final AnalysisFragmentImpl analysisFragment = analysisFragmentImplRef.get(); pdfPreviewSize.set(analysisFragment.getPdfPreviewSize()); } }); assertThat(pdfPreviewSize.get()).isNotNull(); assertThat(pdfPreviewSize.get().height).isGreaterThan(0); assertThat(pdfPreviewSize.get().width).isGreaterThan(0); } }