Skip to content

Instantly share code, notes, and snippets.

Avatar

Logi Ragnarsson logi

  • Belgingur
  • Rome and Reykjavík
View GitHub Profile
@logi
logi / TestTest.kt
Created Sep 14, 2018
Why does the second test faile?
View TestTest.kt
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
/** Test that tests run and that particular testing techniques work. */
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class KtTestTest {
var state = "initial"
View LightTestServer.kt
/**
* Junit5 Extension which sets up a light-server BeforeAll tests and tears it down AfterAll.
* Use with `@ExtendWith(LightTestServer::class)`
*
* The first time a server is started in a particular VM, a random port is assigned to it to avoid clashes between
* concurrent test runs or other active servers.
*
* There are also static utility methods to make requests to the configured server.
*/
class LightTestServer() : BeforeAllCallback, AfterAllCallback {