Search in sources :

Example 1 with MvpPresenter

use of com.hannesdorfmann.mosby3.mvp.MvpPresenter in project mosby by sockeqwe.

the class ActivityMvpDelegateImplTest method dontKeepPresenter.

@Test
public void dontKeepPresenter() {
    ActivityMvpDelegateImpl<MvpView, MvpPresenter<MvpView>> delegate = new ActivityMvpDelegateImpl<>(activity, callback, false);
    startActivity(delegate, null, 1, 1, 1);
    Bundle bundle = BundleMocker.create();
    finishActivity(delegate, bundle, false, 1, true, false);
    startActivity(delegate, bundle, 2, 2, 2);
    finishActivity(delegate, bundle, false, 2, false, true);
}
Also used : MvpView(com.hannesdorfmann.mosby3.mvp.MvpView) Bundle(android.os.Bundle) MvpPresenter(com.hannesdorfmann.mosby3.mvp.MvpPresenter) Test(org.junit.Test)

Example 2 with MvpPresenter

use of com.hannesdorfmann.mosby3.mvp.MvpPresenter in project mosby by sockeqwe.

the class ActivityMvpDelegateImplTest method appStartWithScreenOrientationChangeAndFinallyFinishing.

@Test
public void appStartWithScreenOrientationChangeAndFinallyFinishing() {
    ActivityMvpDelegateImpl<MvpView, MvpPresenter<MvpView>> delegate = new ActivityMvpDelegateImpl<>(activity, callback, true);
    startActivity(delegate, null, 1, 1, 1);
    Bundle bundle = BundleMocker.create();
    finishActivity(delegate, bundle, true, 1, true, false);
    startActivity(delegate, bundle, 1, 2, 2);
    finishActivity(delegate, bundle, false, 1, false, true);
}
Also used : MvpView(com.hannesdorfmann.mosby3.mvp.MvpView) Bundle(android.os.Bundle) MvpPresenter(com.hannesdorfmann.mosby3.mvp.MvpPresenter) Test(org.junit.Test)

Example 3 with MvpPresenter

use of com.hannesdorfmann.mosby3.mvp.MvpPresenter in project mosby by sockeqwe.

the class PresenterManagerTest method putNullPresenterThrowsNullPointerExceptino.

@Test
public void putNullPresenterThrowsNullPointerExceptino() {
    MvpPresenter presenter = Mockito.mock(MvpPresenter.class);
    Activity activity = Mockito.mock(Activity.class);
    Application application = Mockito.mock(Application.class);
    Mockito.when(activity.getApplication()).thenReturn(application);
    try {
        PresenterManager.putPresenter(null, "123", presenter);
        Assert.fail("Exception expected");
    } catch (NullPointerException e) {
    }
    try {
        PresenterManager.putPresenter(activity, null, presenter);
        Assert.fail("Exception expected");
    } catch (NullPointerException e) {
    }
    try {
        PresenterManager.putPresenter(activity, "123", null);
        Assert.fail("Exception expected");
    } catch (NullPointerException e) {
    }
}
Also used : MvpPresenter(com.hannesdorfmann.mosby3.mvp.MvpPresenter) Activity(android.app.Activity) Application(android.app.Application) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with MvpPresenter

use of com.hannesdorfmann.mosby3.mvp.MvpPresenter in project mosby by sockeqwe.

the class ActivityMvpViewStateDelegateImplTestNew method dontKeepPresenterAndViewState.

@Test
public void dontKeepPresenterAndViewState() {
    ActivityMvpViewStateDelegateImpl<MvpView, MvpPresenter<MvpView>, ViewState<MvpView>> delegate = new ActivityMvpViewStateDelegateImpl<>(activity, callback, false);
    startActivity(delegate, null, 1, 1, 1, 1, 1, 0, null, 0, 1, 0);
    Bundle bundle = BundleMocker.create();
    finishActivity(delegate, bundle, false, 1, true, false);
    startActivity(delegate, bundle, 2, 2, 2, 2, 2, 0, null, 0, 2, 0);
    finishActivity(delegate, bundle, false, 2, false, true);
}
Also used : MvpView(com.hannesdorfmann.mosby3.mvp.MvpView) Bundle(android.os.Bundle) MvpPresenter(com.hannesdorfmann.mosby3.mvp.MvpPresenter) ViewState(com.hannesdorfmann.mosby3.mvp.viewstate.ViewState) Test(org.junit.Test)

Example 5 with MvpPresenter

use of com.hannesdorfmann.mosby3.mvp.MvpPresenter in project mosby by sockeqwe.

the class ActivityMvpViewStateDelegateImplTestNew method appStartFinishing.

@Test
public void appStartFinishing() {
    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, false, 1, false, true);
}
Also used : MvpView(com.hannesdorfmann.mosby3.mvp.MvpView) Bundle(android.os.Bundle) MvpPresenter(com.hannesdorfmann.mosby3.mvp.MvpPresenter) ViewState(com.hannesdorfmann.mosby3.mvp.viewstate.ViewState) Test(org.junit.Test)

Aggregations

MvpPresenter (com.hannesdorfmann.mosby3.mvp.MvpPresenter)10 Test (org.junit.Test)10 MvpView (com.hannesdorfmann.mosby3.mvp.MvpView)9 Bundle (android.os.Bundle)8 ViewState (com.hannesdorfmann.mosby3.mvp.viewstate.ViewState)5 Activity (android.app.Activity)2 Application (android.app.Application)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Answer (org.mockito.stubbing.Answer)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2