You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I mocking a overload private method, It does not take any affect. I found this may be effected by “Matchers.any(Class clazz)” can not passed by variable parameter, and then WhiteboxImpl.java on line 870 will always pick up last passed method.
following is mycode:
package com.ehm.cost.service.impl;
public class ParamsClass {
}
package com.ehm.cost.service.impl;
import java.util.List;
public class TestOverload {
public String CallOverload(ParamsClass paramsClass, List<ParamsClass> s) {
return overload(paramsClass, s);
}
private String overload(List a, List<ParamsClass> b) {
return "call real overloadSecond";
}
private String overload(ParamsClass a, List<ParamsClass> b) {
return "call real overloadFirst";
}
}
When I mocking a overload private method, It does not take any affect. I found this may be effected by “Matchers.any(Class clazz)” can not passed by variable parameter, and then WhiteboxImpl.java on line 870 will always pick up last passed method.
following is mycode:
When I run test,the result is:
call real overloadFirst
but expect:
call mock method
The text was updated successfully, but these errors were encountered: