【发布时间】:2020-06-08 23:59:25
【问题描述】:
在需要config: Config 的类的单元测试中,我想以可视方式(而不是在位于其他地方的配置文件中)声明测试的假定配置设置。
例如,我想做这样的事情:
class myClassSpec extends AnyFlatSpec{
val myTestingConfigForThisTestCase = 3L
val config = ConfigFactory.load()
.withValue("my-config-path", myTestingConfigForThisTestCase)
...
}
但是,withValue 需要 ConfigValue,而且基本类型之间似乎没有隐式转换。
关于简单解决方案的任何想法?
【问题讨论】:
标签: scala unit-testing typesafe-config