I have a transactional scope like follows (Spring docs) and I get it working:
class PersonRepository(private val operator: TransactionalOperator) {
suspend fun initDatabase() = operator.executeAndAwait {
insertPerson1()
insertPerson2()
}
}
But when I try to mock TransactionalOperator in my test like this:
val transactionalOperator = mockk<TransactionalOperator>(relaxed = true)
I get a timeout every time my test needs the methods that use the operator. Also I haven't found documentation about it.
Does someone have an example of working with tests and mocks on programmatic variant of the Reactive transaction management?
Thanks!