gpt4 book ai didi

java - JMockit 与 null 匹配

转载 作者:行者123 更新时间:2023-11-30 02:51:40 25 4
gpt4 key购买 nike

      new Expectations() {{
someMethod.getLocalObj().getValue((SomeClass)any);
returns(1);
times=1;

request.doSomething().setTransaction((null)any); // HERE****how to match ??
times=0;
}};

嗨。我正在尝试匹配将变量设置为 null 的方法。我怎样才能在 JMockit 中做到这一点?

谢谢。

最佳答案

您正在此处寻找此方法:withNull() :

与 withEqual(Object) 相同,但检查重播阶段的调用参数是否为空。

关于java - JMockit 与 null 匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38456779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com