I wrote the following test:
@RunWith(SpringJUnit4ClassRunner::class)
class KotlinTest : BehaviorSpec() {
init {
given("a stack") {
val stack = Stack<String>()
`when`("an item is pushed") {
stack.push("kotlin")
then("the stack should not be empty") {
stack.isEmpty() shouldBe true
}
}
`when`("the stack is popped") {
stack.pop()
then("it should be empty") {
stack.isEmpty() shouldBe false
}
}
}
}
}
When I try to run it, I have the following error:
java.lang.Exception: No runnable methods
at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:191)
at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)
at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:138)
I know that the problem is that I am trying to run a test written with KotlinTest with Spring, but how can I do it? What runner should I use?
The example test doesn't need spring, this was just a simple example that I wrote to isolate the problem