Skip to content

Instantly share code, notes, and snippets.

@gedorinku
Created December 9, 2017 15:58
Show Gist options
  • Save gedorinku/2ec2f0eb433def777c5342a0e260445f to your computer and use it in GitHub Desktop.
Save gedorinku/2ec2f0eb433def777c5342a0e260445f to your computer and use it in GitHub Desktop.
package io.github.gedorinku.ktorapp
import io.ktor.application.Application
import io.ktor.http.HttpMethod
import io.ktor.http.HttpStatusCode
import io.ktor.server.testing.handleRequest
import io.ktor.server.testing.withTestApplication
import org.junit.Test
import kotlin.test.assertEquals
/**
* Created by gedorinku on 2017/12/09.
*/
class ApplicationTest {
@Test fun testHello() = withTestApplication(Application::sampleApplication) {
handleRequest(HttpMethod.Get, "/").run {
assertEquals(HttpStatusCode.OK, response.status())
assertEquals("Hello", response.content)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment