Tag: 春季测试

如何让kotlintest与Spring一起工作?

我试图使用kotlintest与spring(不是春季启动,只是标准的春季测试)。 我觉得这很难做到。 任何指针,我在做什么错? 我也是Kotlin的新手,所以我可能不会做正确的事情。 这是我迄今为止所尝试的: import io.kotlintest.matchers.shouldBe import io.kotlintest.specs.BehaviorSpec import org.junit.ClassRule import org.junit.Rule import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.junit4.rules.SpringClassRule import org.springframework.test.context.junit4.rules.SpringMethodRule open class SomeBean { open fun sayHello() = “Hello” } @Configuration open class TestConfig { @Bean open fun someBean(): SomeBean = SomeBean() } @ContextConfiguration(classes = arrayOf(TestConfig::class)) open class MyTests(var someBean: SomeBean) : […]