我想使用EasyMock在Java中为以下受保护的最终方法编写测试用例。有什么方法可以使用EasyMock编写受保护的最终方法的测试用例吗?
我尝试使用反射方法编写TC,但是没有用。
Class < ? extends Entity > type;
private Filter filter;
private Input input;
private transient Service access;
private transient ConfigDao confdao;
protected final Limitation getBaseLimitation() {
Validate.notNull(type);
GroupClass Group = new GroupClass(GroupTypeclass.SELECTOR);
if (A.class.isAssignableFrom(type)) {
filter = new Simple(A.ATTRIBUTE_actIVE,Operator.EQUALS,Boolean.TRUE); //A class has static final static String ATTRIBUTE_actIVE = "active";
}
if (G.class.isAssignableFrom(type)) {
filter = new Simple("position",Position.actIVE);
}
if (Boolean.TRUE.equals(confdao.getconfdao().getarea())) {
if (U.class.isAssignableFrom(type)) {
Validate.notNull(input,"switched on.");
Object Inputobj = input.getInput();
return access.getBaseLimitation(type,Inputobj,Group,filter);
}
}
return access.getBaseLimitation(type,filter);
}
public Simple(String path,Operator operator,Object value) {
this(Path,operator,new Object[]{value});
}
任何帮助将不胜感激。