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.
I want to mock B and mock behaviour B.make. Please suggest a solution. I am writing a test for class A
public class A {
private ArkSolver B = new ArkSolver();
public Itinerary execute() {
other1();
other2();
buildArkTripPlans();
return other3();
}
private void private1OfA() {
ArkTripPlan arkTripPlan = new C.LeafArkTripPlanner(ark).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 createTripPlan(leafArk);
}
}
}
Aucun commentaire:
Enregistrer un commentaire