Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import io.ktor.server.application.Application
import io.ktor.server.testing.*
import kotlin.test.*

Expand All @@ -17,4 +18,21 @@ class ApplicationTest {
assertEquals(HttpStatusCode.OK, response.status)
assertEquals("Hello from 'module1'!", response.bodyAsText())
}

@Test
fun testAccessApplicationInstance() = testApplication {
lateinit var configuredApplication: Application

application {
configuredApplication = this
}

startApplication()

// Accesses the application property
val app: Application = application

// Asserts it’s the same instance
assertSame(configuredApplication, app)
}
}
Loading