All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.com.dius.pact.provider.spring.spring6.WebTestClientSpring6Target.kt Maven / Gradle / Ivy

package au.com.dius.pact.provider.spring.spring6

import au.com.dius.pact.core.model.Interaction
import au.com.dius.pact.core.model.Pact
import au.com.dius.pact.core.model.SynchronousRequestResponse
import au.com.dius.pact.core.model.generators.GeneratorTestMode
import org.springframework.test.web.reactive.server.WebTestClient

class WebTestClientSpring6Target(private val webTestClient: WebTestClient) : WebFluxBasedTestTarget {
    override val userConfig: Map = emptyMap()

    override fun prepareRequest(
        pact: Pact,
        interaction: Interaction,
        context: MutableMap
    ): Pair? {
        if (interaction is SynchronousRequestResponse) {
            val request = interaction.request.generatedRequest(context, GeneratorTestMode.Provider)
            return toWebFluxRequestBuilder(webTestClient, request) to webTestClient
        }
        throw UnsupportedOperationException("Only request/response interactions can be used with a WebFlux test target")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy