Below is my class
public class SomeClass {
public ReturnType1 testThisMethod(Type1 param1, Type2 param2) {
helperMethodPublic(param1,param2);
}
public ReturnType2 helperMethodPublic(Type1 param1, Type2 param2) {
}
}
So, in the above class when testing testThisMethod () I want to partially mock helperMethodPublic ().
I am currently doing the following:
SomeClass someClassMock =
PowerMock.createPartialMock(SomeClass.class,"helperMethodPublic");
PowerMock.expectPrivate(someClassMock, "helperMethodPublic, param1, param2).
andReturn(returnObject);
The compiler does not complain. So I try to run my test, and when the code gets into the helperMethodPublic () method, the control goes into the method and starts to execute each line of code. How to prevent this?
source
share