title: How to mock a class member object method which got called from an inner class
body: <p>I want to write a test for class A which has an inner class C and private member class B. A calls class C  and  C calls one private method of A to execute 'make' behaviour B. Below code will give you the clarity. </p>
  
  <p>I want to mock B and mock behaviour B.make. Please suggest a solution. I am writing a test for class A</p>
  
  <pre><code>
  
  public class A {
      private ArkSolver B = new ArkSolver()
      void someMethod(){
         new C().plan();
      }
  
      private ArkTripPlan private2ofA (Ark ark) throws VRPSolverException {
          ArkTripPlan tripPlan = B.make(arg1,arg2,arg3);
  
          return tripPlan;
      }
  
      private class C {
          private Ark leafArk;
  
          public ArkTripPlan plan() throws VRPSolverException {
              return private2ofA (leafArk);
  
          }
      }
  }
  </code></pre>