title: Mockito wanted but not invoked - However, there was exactly 1 interaction with this mock
body: <p>This is the first time I use mockito &amp; roboelectric to make unit test on android studio.
  <br/>I want to verify that view.onSuccessLogin() called when request to server / API is success. But, I got an error "wanted but not invoked - However, there was exactly 1 interaction with this mock"</p>
  
  <p>Here is my presenter class :</p>
  
  <pre><code>class PresenterLogin internal constructor(private val view: View) {
  
  private val compositeDisposable = CompositeDisposable()
  
  interface View : BaseView {
      fun onSuccessLogin()
  }
  
  fun requestLogin(username: String, password: String) {
      view.showProgressDialog()
      val disposable = ApiHelper.service.requestSignIn(ApiHeaders().headers,
              username, password, AppPreference.getInstance().firebaseToken)
              .map { response -&gt; return@map response.toString() }
              .observeOn(AndroidSchedulers.mainThread())
              .subscribeOn(Schedulers.io())
              .subscribe(
                      { response -&gt;
                          view.hideProgressDialog()
                          view.onSuccessLogin()
                      },
                      { error -&gt;
                          view.hideProgressDialog()
                          view.showError(error.message)
                      }
              )
      compositeDisposable.add(disposable)
  }
  
  fun onViewDestroyed() {
      compositeDisposable.dispose()
  }
  }
  </code></pre>
  
  <p>This is my PresenterLoginTest class</p>
  
  <pre><code>@RunWith(RobolectricTestRunner::class)
  @Config(constants = BuildConfig::class)
  class PresenterLoginTest {
  
  private lateinit var activity: ActivityLogin
  
  @Mock
  lateinit var view: PresenterLogin.View
  @Mock
  lateinit var service: ApiService
  @Mock
  lateinit var callLogin: Observable&lt;Login&gt;
  
  private lateinit var presenter: PresenterLogin
  
  @Before
  fun setUp() {
      activity = Robolectric.buildActivity(ActivityLogin::class.java)
              .create()
              .resume()
              .get()
      MockitoAnnotations.initMocks(this)
      presenter = PresenterLogin(view)
  }
  
  @Test
  @Throws(Exception::class)
  fun shouldNotBeNull() {
      assertNotNull(activity) // Success
  }
  
  @Test
  fun requestLogin() {
      Mockito.`when`(service.requestSignIn(
              ApiHeaders().headers, "081212345678", "12345", ""))
              .thenReturn(Observable.just(Login()))
      presenter.requestLogin("081212345678", "12345")
      verify(view).showProgressDialog() // Success
      verify(view).onSuccessLogin()
      /*
      Wanted but not invoked:
      view.onSuccessLogin();
      -&gt; at package.PresenterLoginTest.requestLogin(PresenterLoginTest.kt:117)
  
      However, there was exactly 1 interaction with this mock:
      view.showProgressDialog();
      */
  }
  }
  </code></pre>