有什么方法可以为常量文件生成测试用例吗?

发布于 2025-02-13 14:38:38 字数 649 浏览 0 评论 0原文

当我尝试通过使用DiffBlue封面生成常量文件的测试用例。它显示“没有发现测试的方法:Diffblue覆盖物无法找到您选择中可以测试的任何方法。”有什么方法可以为该文件生成测试用例吗?

public class ApiValidationErrorConstants {
    public static final String ACCOUNT_MUST_NOT_BE_NULL = "Account cannot be null";
    public static final String ACCOUNT_CANNOT_BE_NEGATIVE = "Account cannot be negative";
    public static final String APP_MUST_NOT_BE_NULL = "App cannot be null";
    public static final String INTEGRATION_MUST_NOT_BE_NULL = "Integration cannot be null";
    public static final String INTEGRATION_CANNOT_BE_NEGATIVE = "Integration cannot be negative";
}

When I try to generate test cases for constant file by using Diffblue cover. it shows "No methods found to test: Diffblue Cover was unable to find any methods that can be tested in your selection.". Is there any way to generate test cases for this file?

public class ApiValidationErrorConstants {
    public static final String ACCOUNT_MUST_NOT_BE_NULL = "Account cannot be null";
    public static final String ACCOUNT_CANNOT_BE_NEGATIVE = "Account cannot be negative";
    public static final String APP_MUST_NOT_BE_NULL = "App cannot be null";
    public static final String INTEGRATION_MUST_NOT_BE_NULL = "Integration cannot be null";
    public static final String INTEGRATION_CANNOT_BE_NEGATIVE = "Integration cannot be negative";
}

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

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

发布评论

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

评论(1

一个人练习一个人 2025-02-20 14:38:38

尝试添加空白构造函数

try adding a blank constructor

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