Last active
June 14, 2016 10:45
-
-
Save rafakob/d4df8a6b3ffeffbd929aa2ff915e189f to your computer and use it in GitHub Desktop.
Revisions
-
rafakob revised this gist
Jun 14, 2016 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,4 +28,14 @@ public void testLogin() throws Exception { loginPresenter.register(); verify(loginPresenter).blablaMethod(); } } /////// RESULT ///// Wanted but not invoked: loginPresenter.blablaMethod(); -> at io.tsh.spincar.ui.login.LoginPresenterTest.testLogin(LoginPresenterTest.java:23) However, there were other interactions with this mock: loginPresenter.register(); -> at io.tsh.spincar.ui.login.LoginPresenterTest.testLogin(LoginPresenterTest.java:22) -
rafakob created this gist
Jun 14, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ public class LoginPresenter extends MvpPresenter<LoginView> { public void register() { blablaMethod(); } public void blablaMethod(){ } } ///////// TEST ///////// public class LoginPresenterTest { private LoginPresenter loginPresenter; private LoginView view; @Before public void setUp() throws Exception { loginPresenter = Mockito.mock(LoginPresenter.class); view = Mockito.mock(LoginView.class); loginPresenter.bindView(view); } @Test public void testLogin() throws Exception { loginPresenter.register(); verify(loginPresenter).blablaMethod(); } }