Hello~!
I’m trying to use SpringExtension With IsolationMode.InstancePer(Test | Leaf), But it is not working…
ex) in kotest-extensions-spring test
if I change this code to
Copy code
...
@ContextConfiguration(classes = [(Components::class)])
class SpringExtensionTest : WordSpec() {
override fun isolationMode() = IsolationMode.InstancePerTest // or InstancePerLeaf
override fun extensions() = listOf(SpringExtension)
@Autowired
private var service: UserService? = null
init {
"SpringExtension" should {
"have autowired the service" {
service?.repository?.findUser()?.name shouldBe "system_user"
}
...
‘have autowired the service’ test is broken
---
but I change this code to
Copy code
...
@ContextConfiguration(classes = [(Components::class)])
class SpringListenerTest : WordSpec() {
override fun isolationMode() = IsolationMode.InstancePerTest // or InstancePerLeaf
override fun listeners() = listOf(SpringListener)
@Autowired
private var service: UserService? = null
init {
"SpringListener" should {
"have autowired the service" {
service?.repository?.findUser()?.name shouldBe "system_user"
}
...
It works
s
sam
07/20/2021, 10:50 AM
Might be a bug with extensions vs listeners
h
HunJeong
07/20/2021, 12:08 PM
Thank you for your answer 🙂
Is it known issue?, or Do I need to open issue?