派突变测试失败:org.pitest.munttest.engine.gregor.mutators.emptyObjectReturnvalsMutator

发布于 2025-01-31 06:18:48 字数 220 浏览 4 评论 0原文

在进行突变测试时,有幸存的情况。原因是org.pitest.munttest.engine.gregor.mutators.mutator.emptyobjectreturnvalsmutator

确切的错误消息是:替换为collections.take/javafile for Package/javafile :: method→幸存下来

我添加了很少的测试案例,但仍然失败了,但仍然失败了。

While running mutation test , there are survived cases . The reason is org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator

The exact error message is : replaced return value with Collections.emptyList for package/JavaFile::Method → SURVIVED

I added few test cases to pass the emptyList but still failed.Can anyone please help here about this and what's the test case need to be added?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆躺在深渊里 2025-02-07 06:18:48

对于返回设置的方法,有一个典型的情况。

例子:
私有设置execute(){
}

此集合始终具有值(或)为空集。

对此方法的调用“返回execute()”显示了用Collections替换的返回值的问题。

逻辑更改为“返回可选”(execute()),

这解决了问题。

There is a typical case for a method which returns Set.

Example:
private Set execute() {
}

This set is always with value (or) empty set.

The call to this method 'return execute()' showed the issue of replaced return value with Collections.emptyList for package/JavaFile::Method → SURVIVED.

The logic is changed like 'return Optional.of(execute())'

This solved the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文