com.trendyol.stove.testing.e2e.KtorBridgeSystem.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stove-ktor-testing-e2e Show documentation
Show all versions of stove-ktor-testing-e2e Show documentation
The easiest way of e2e testing in Kotlin
package com.trendyol.stove.testing.e2e
import com.trendyol.stove.testing.e2e.system.*
import com.trendyol.stove.testing.e2e.system.abstractions.*
import com.trendyol.stove.testing.e2e.system.annotations.StoveDsl
import io.ktor.server.application.*
import org.koin.ktor.ext.*
import kotlin.reflect.KClass
/**
* A system that provides a bridge between the test system and the application context.
*
* @property testSystem the test system to bridge.
*/
@StoveDsl
class KtorBridgeSystem(
override val testSystem: TestSystem
) : PluggedSystem, AfterRunAwareWithContext, BridgeSystem(testSystem) {
override fun get(klass: KClass): D = ctx.getKoin().get(klass)
}
@StoveDsl
fun WithDsl.bridge(): TestSystem = this.testSystem.withBridgeSystem(KtorBridgeSystem(this.testSystem))