title: Mocked method doesn't return expected value
body: <p>I want to test a method of my class using Mockito.</p>
  
  <pre><code>public class SplashPresenter {
      public volatile State mField1 = State.DEFAULT;
      public volatile State mField2 = State.DEFAULT;
  
      boolean stateFlagsAreAllCompleted(@NonNull final ISplashView view) {
          if (mField1 == State.COMPLETE //
                  &amp;&amp; mField2 == State.COMPLETE) {
  
              // Check Forced Update
              final int updateCheckResult = checkForcedUpdate(); // &lt;===
              if (updateCheckResult == MyConstants.PRODUCTION_UPDATE_AVAILABLE) {
                  view.displayForcedUpdateAlert(false);
                  return true;
              }
  
              if (updateCheckResult == MyConstants.BETA_UPDATE_AVAILABLE) {
                  view.displayForcedUpdateAlert(true);
                  return true;
              }
  
              view.restartLoader();
              // Move to the home screen
              return true;
          }
  
          return false;
      }
  
      int checkForcedUpdate() {
      ...... // my codes
      }
  }
  </code></pre>
  
  <p>and this is my test class:</p>
  
  <pre><code>public class SplashPresenterTest_ForStateFlags {
  
      private Context mContext;
      private ISplashView mView;
  
      @Before
      public void setUp() throws Exception {
          mContext = Mockito.mock(Context.class);
          mView = Mockito.mock(ISplashView.class);
      }
  
      @Test
      public void stateFlagsAreAllCompleted() throws Exception {
          SplashPresenter presenter = Mockito.mock(SplashPresenter.class);
          presenter.mField1 = State.COMPLETE;
          presenter.mField2 = State.COMPLETE;
  
          when(presenter.checkForcedUpdate()).thenReturn(1);
  
          boolean actual = presenter.stateFlagsAreAllCompleted(mView);
          System.out.println("actual: " + actual + ", " +
                  presenter.mField1 + ", " +
                  presenter.checkForcedUpdate());
          assertTrue(actual);
      }
  }
  </code></pre>
  
  <p>Test failure is what happens at the end. This is the output:</p>
  
  <blockquote>
    <p>actual: false, COMPLETE, 1</p>
  </blockquote>
  
  <p>The thing that I don't understand is even I change the <code>stateFlagsAreAllCompleted</code> method to following code then still test fails with above output.</p>
  
  <pre><code>boolean stateFlagsAreAllCompleted(@NonNull final ISplashView view) {
  
      return true;
  }
  </code></pre>