title: Mockito. How to return a boolean value based on mocked object as parameter?
body: <pre><code>Class A
  {
  public B makeB(int q)
      {
          return new B(q);
      }
      public boolean evaluate(int q)
      {
          B b = makeB(q);
          boolean result = b.get();
          return result;
      }
  }
  
  Class B
  {
      int e;
      public B(int w)
      {
          e=w;
      }
      public boolean get()
      {
          //return boolean based on object B
      } 
  }
  
  Class ATest
  {
      A a = spy(A.class);
      B b1 = mock(B.class);
      B b2 = mock(B.class);
  
      doReturn(b1).when(a).makeB(5);
      doReturn(b2).when(a).makeB(10);
  
      when(b1.get()).thenReturn(true);
      when(b2.get()).thenReturn(false);
  
      a.evaluate();
  }
  </code></pre>
  
  <p>=======================</p>
  
  <p>Here I would like to return true from method evaluate when object B contains value 5 and false if it contains value 10.</p>
  
  <p>Class B is from an external Library.</p>
  
  <p>New to unit testing and mockito.</p>