OnboardingFragmentImpl extends OnboardingScreenContract.View { @Override public void setListener(@NonNull final OnboardingFragmentListener listener) { getPresenter().setListener(listener); } OnboardingFragmentImpl(final OnboardingFragmentImplCallback fragment,
            final boolean showEmptyLastPage);  OnboardingFragmentImpl(final OnboardingFragmentImplCallback fragment,
            final boolean showEmptyLastPage, final ArrayList<OnboardingPage> pages); @Override void setListener(@NonNull final OnboardingFragmentListener listener); View onCreateView(final LayoutInflater inflater, final ViewGroup container,
            final Bundle savedInstanceState);  }
@Test public void should_passListener_toPresenter() throws Exception { final OnboardingScreenPresenter presenter = mock(OnboardingScreenPresenter.class); final AtomicReference<OnboardingFragmentImpl> onboardingFragmentImplRef = new AtomicReference<>(); final ActivityScenario<OnboardingFragmentHostActivity> scenario = launchHostActivity(presenter, onboardingFragmentImplRef, false, null); final OnboardingFragmentListener listener = new OnboardingFragmentListener() { @Override public void onCloseOnboarding() { } @Override public void onError(@NonNull final GiniVisionError error) { } }; scenario.onActivity(new ActivityScenario.ActivityAction<OnboardingFragmentHostActivity>() { @Override public void perform(final OnboardingFragmentHostActivity activity) { final OnboardingFragmentImpl onboardingFragmentImpl = onboardingFragmentImplRef.get(); onboardingFragmentImpl.setListener(listener); } }); verify(presenter).setListener(listener); }