Hi there.
I think there is a problem when Studio generates an integration test stub in Kotlin. Here’s an example:
package com.test.kipper.service
import com.haulmont.cuba.core.global.AppBeans
import com.haulmont.cuba.core.global.DataManager
import com.haulmont.cuba.testsupport.TestContainer
import com.willowparkmedia.kipper.KipperTestContainer
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension
import org.junit.jupiter.api.Assertions.*
// See https://doc.cuba-platform.com/manual-7.2/integration_tests_mw.html
internal class MyIntegrationTest {
@Test
fun myTestMethod() {
}
companion object {
@JvmField
@RegisterExtension
var container: TestContainer = KipperTestContainer.Common.INSTANCE
lateinit var dataManager: DataManager
@BeforeAll
fun beforeAll() {
dataManager = AppBeans.get(DataManager::class.java)
}
}
}
The beforeAll
method is missing a @JvmStatic
annotation. Without it, the beans won’t instantiate properly.