在需要config: Config
的类的单元测试中,我想直观地(而不是在其他位置的配置文件中)声明该测试的假定配置设置。
例如,我想做这样的事情:
class myClassspec extends AnyflatSpec{
val myTestingConfigForThisTestCase = 3L
val config = ConfigFactory.load()
.withValue("my-config-path",myTestingConfigForThisTestCase)
...
}
但是,withValue
期望ConfigValue
,并且基本类型与该类型之间似乎没有隐式转换。
关于简单解决方案的任何想法吗?