无法模仿华丽';s persistAndFlush()由于lambda表达式

无法模仿华丽';s persistAndFlush()由于lambda表达式,lambda,mockito,junit5,quarkus,quarkus-panache,Lambda,Mockito,Junit5,Quarkus,Quarkus Panache,我正在使用Quarkus和hibernate华丽的orm。下面是我的示例代码 Optional<OtherObject> opt = object.getList().stream().filter(predicate).findFirst(); if(opt.isPresent()){ OtherObject obj = opt.get() obj.setVal("SomeVal"); opt.persistAndFlush(); }

我正在使用Quarkus和hibernate华丽的orm。下面是我的示例代码

Optional<OtherObject> opt = object.getList().stream().filter(predicate).findFirst();
if(opt.isPresent()){
    OtherObject obj = opt.get()
    obj.setVal("SomeVal");
    opt.persistAndFlush();
}
Optional opt=object.getList().stream().filter(谓词).findFirst();
if(opt.isPresent()){
OtherObject obj=opt.get()
对象设定值(“某个值”);
opt.persistAndFlush();
}
如果我将
对象的实际值从测试类传递到主类,那么
opt.persistAndFlush()
步骤将失败。否则不了解如何模拟
.filter(谓词)
步骤。 请帮忙。提前谢谢