title: Why does Mockito complain about misusing.WrongTypeOfReturnValue when the parameters are correct?
body: <p>I am running my login unit tests which keep returning errors :</p>
  
  <pre><code>org.mockito.exceptions.misusing.WrongTypeOfReturnValue: 
  ObservableJust cannot be returned by doServerLoginApiCall()
  doServerLoginApiCall() should return Single
  ***
  If you're unsure why you're getting above error read on.
  Due to the nature of the syntax above problem might occur because:
  1. This exception *might* occur in wrongly written multi-threaded tests.
     Please refer to Mockito FAQ on limitations of concurrency testing.
  2. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub spies - 
     - with doReturn|Throw() family of methods. More in javadocs for Mockito.spy() method.
  </code></pre>
  
  <p>I am not sure why that throws, even when I cross checked everything is correct even though tests keep failing due to the above reason. Here's my code: 
  LoginPresenterTest:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class LoginPresenterTest {
  
      @Mock
      LoginMvpView mMockLoginMvpView;
      @Mock
      DataManager mMockDataManager;
  
      private LoginPresenter&lt;LoginMvpView&gt; mLoginPresenter;
      private TestScheduler mTestScheduler;
  
      @BeforeClass
      public static void onlyOnce() throws Exception {
      }
  
      @Before
      public void setUp() throws Exception {
          CompositeDisposable compositeDisposable = new CompositeDisposable();
          mTestScheduler = new TestScheduler();
          TestSchedulerProvider testSchedulerProvider = new TestSchedulerProvider(mTestScheduler);
          mLoginPresenter = new LoginPresenter&lt;&gt;(
              mMockDataManager,
              testSchedulerProvider,
              compositeDisposable);
          mLoginPresenter.onAttach(mMockLoginMvpView);
      }
  
      @Test
      public void testServerLoginSuccess() {
  
          String email = "dummy@gmail.com";
          String password = "password";
  
          LoginResponse loginResponse = new LoginResponse();
  
          doReturn(Observable.just(loginResponse))
                  .when(mMockDataManager)
                  .doServerLoginApiCall(new LoginRequest
                          .ServerLoginRequest(email, password));
  
          mLoginPresenter.onServerLoginClick(email, password);
  
          mTestScheduler.triggerActions();
  
          verify(mMockLoginMvpView).showLoading();
          verify(mMockLoginMvpView).hideLoading();
          verify(mMockLoginMvpView).openMainActivity();
      }
  
  
      @After
      public void tearDown() throws Exception {
          mLoginPresenter.onDetach();
      }
  </code></pre>
  
  <p>Here is my testscheduleprovider : </p>
  
  <pre><code>public class TestSchedulerProvider implements SchedulerProvider {
  
      private final TestScheduler mTestScheduler;
  
      public TestSchedulerProvider(TestScheduler testScheduler) {
          this.mTestScheduler = testScheduler;
      }
  
      @Override
      public Scheduler ui() {
          return mTestScheduler;
      }
  
      @Override
      public Scheduler computation() {
          return mTestScheduler;
      }
  
      @Override
      public Scheduler io() {
          return mTestScheduler;
      }
  
  }
  </code></pre>
  
  <p>The error is thrown at LoginPresentertest at the line </p>
  
  <pre><code> .doServerLoginApiCall(new LoginRequest
                          .ServerLoginRequest(email, password));
  </code></pre>
  
  <p>Any idea how I can alter this to work?</p>
  
  <p>Thanks!</p>