use of com.hannesdorfmann.mosby3.mvp.viewstate.ViewState in project mosby by sockeqwe.
the class ActivityMvpViewStateDelegateImplTestNew method appStartWithScreenOrientationChangeAndFinallyFinishing.
@Test
public void appStartWithScreenOrientationChangeAndFinallyFinishing() {
ActivityMvpViewStateDelegateImpl<MvpView, MvpPresenter<MvpView>, ViewState<MvpView>> delegate = new ActivityMvpViewStateDelegateImpl<>(activity, callback, true);
startActivity(delegate, null, 1, 1, 1, 1, 1, 0, null, 0, 1, 0);
Bundle bundle = BundleMocker.create();
finishActivity(delegate, bundle, true, 1, true, false);
startActivity(delegate, bundle, 1, 2, 2, 1, 2, 1, true, 1, 1, 1);
finishActivity(delegate, bundle, false, 1, false, true);
}
use of com.hannesdorfmann.mosby3.mvp.viewstate.ViewState in project mosby by sockeqwe.
the class ActivityMvpViewStateDelegateImplTestNew method appStartAfterProcessDeathAndViewStateRecreationFromBundle.
@Test
public void appStartAfterProcessDeathAndViewStateRecreationFromBundle() {
ActivityMvpViewStateDelegateImpl<MvpView, MvpPresenter<MvpView>, ViewState<MvpView>> delegate = new ActivityMvpViewStateDelegateImpl<>(activity, callback, true);
Mockito.doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
viewState = Mockito.spy(new SimpleRestorableViewState());
return viewState;
}
}).when(callback).createViewState();
Bundle bundle = BundleMocker.create();
bundle.putString(ActivityMvpViewStateDelegateImpl.KEY_MOSBY_VIEW_ID, "123456789");
startActivity(delegate, bundle, 1, 1, 1, 1, 1, 1, false, 1, 0, 1);
}
use of com.hannesdorfmann.mosby3.mvp.viewstate.ViewState in project mosby by sockeqwe.
the class FragmentMvpViewStateDelegateImplTest method initComponents.
@Before
public void initComponents() {
view = new MvpView() {
};
viewState = Mockito.mock(ViewState.class);
presenter = Mockito.mock(MvpPresenter.class);
callback = Mockito.spy(PartialMvpViewStateDelegateCallbackImpl.class);
Mockito.doCallRealMethod().when(callback).setPresenter(presenter);
Mockito.doCallRealMethod().when(callback).getPresenter();
Mockito.doCallRealMethod().when(callback).setViewState(viewState);
Mockito.doCallRealMethod().when(callback).getViewState();
fragment = PowerMockito.mock(Fragment.class);
activity = Mockito.mock(FragmentActivity.class);
application = Mockito.mock(Application.class);
Mockito.when(callback.getMvpView()).thenReturn(view);
Mockito.when(fragment.getActivity()).thenReturn(activity);
Mockito.when(activity.getApplication()).thenReturn(application);
Mockito.when(callback.createPresenter()).thenReturn(presenter);
Mockito.when(callback.createViewState()).thenReturn(viewState);
delegate = new FragmentMvpViewStateDelegateImpl<>(fragment, callback, true, true);
}
Aggregations