Use @ClassRule in Kotlin

Viewed 5833

In JUnit you can use @ClassRule to annotate an static field. How can I do this in Kotlin?

I tried:

object companion {
    @ClassRule @JvmStatic
    val managedMongoDb = ...    
}

and 

object companion {
    @ClassRule @JvmField
    val managedMongoDb = ...    
}

but none of the last works because rule isn't executed.

I double checked that exactly same rule works fine without static context:

@Rule @JvmField
val managedMongoDb = ...
1 Answers
Related