【发布时间】:2019-06-11 08:00:57
【问题描述】:
我使用 Micronaut 作为开发 AWS Java Lambda 的框架。
Micronaut 支持 @Value 读取“值”。
@io.micronaut.context.annotation.Factory
public class SomeFactory {
public SomeFactory(
@io.micronaut.context.annotation.Value("${NameOfValue}")
final String value) {
...
}
...
}
testing 时,我想将“NameOfValue”设置为特定值,我该怎么做?
@io.micronaut.test.annotation.MicronautTest
class SomeLambdaIT {
@org.junit.jupiter.api.Test
void aTest() {
// When this test runs, "NameOfValue" shall be set to a specific value
}
}
【问题讨论】: