title: How to stub a method with complex object as parameter in Mockito
body: <p>My Class looks in this way:</p>
  
  <pre><code>   public class MyClass{
          A obj;
          List&lt;B&gt; Obj1;
        }
      public class A{
       C obj2;
       }
      public class B{
        List values;
      }
  </code></pre>
  
  <p>There is a method <code>addToCart()</code> in class <code>MyClassImpl</code> as below:</p>
  
  <pre><code>          class MyClassImpl{
                 addToCart(MyClass c, String x, String Y, String Z);
  
           } 
  </code></pre>
  
  <p>I am writing a Test Class to <code>MyClassImpl</code>. I am able to pass test values of x,y and z to the <code>addToCart()</code>, but as c is a complex object, how do I stub this method with values? Setting values deeper is taking time for me.</p>