java - Specify return value for private method mockito -


i have situation this

class a{       public method1(){       result = method2();     }      private method2(){       result = method3()       processing;       return result2;     }     private method3(){       processing;       return result;      }   } 

i want test method1(), when method2 calls method3, don't want actual method3 execute, return value want. there way this?

the simplest solution comment out line: result = method3() in implementation of method 2, , instead set result equal return value want method3.


Comments