我在一些测试中使用Mockito.
我有以下课程:
class BaseService {
public void save() {...}
}
public Childservice extends BaseService {
public void save(){
//some code
super.save();
}
}
Run Code Online (Sandbox Code Playgroud)
我想只模拟第二个调用(super.save
)ChildService
.第一个调用必须调用真正的方法.有没有办法做到这一点?
我有这个对象:
@Service
public class myBr {
@PostFilter("filterObject.cellule.getId()==2")
public List<Bibliotheque> getB() {
return super.getAll();
}
public List<Bibliotheque> getA() {
return getB();
}
}
Run Code Online (Sandbox Code Playgroud)
当我从测试中调用时myBr.getB()
,@PostFilter
会应用,但是当我调用时myBr.getA()
,后置过滤器不起作用.
有没有办法处理这个,以便应用过滤器?