有什么方法可以为常量文件生成测试用例吗?
当我尝试通过使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试添加空白构造函数
try adding a blank constructor