BryanT
04/17/2023, 1:23 PMprivate fun testApplicationWrapper2(testBlock: suspend ApplicationTestBuilder.(HttpClient) -> Unit) {
testApplication {
application {
...
What I'm attempting to do... handle custom HttpClient creation at the class level so that each test case need not create it. I have that working using a lateinit var, but was hoping the set up could be done and passed in via the testApplicationWrapper.private fun testApplicationWrapper2(testBlock: suspend ApplicationTestBuilder.(HttpClient) -> Unit) {
testApplication {
application {
configureRouting()
configureSerialization()
}
val client: HttpClient = createClient {
install(ContentNegotiation) {
json()
}
}
testBlock(client)
// usage found at <https://youtrack.jetbrains.com/issue/KTOR-4773>
}
}
Aleksei Tirman [JB]
04/18/2023, 9:02 AMtestApplicationWrapper2
method solved your problem?BryanT
04/18/2023, 2:25 PM