Skip to content

Instantly share code, notes, and snippets.

View logi's full-sized avatar

Logi Ragnarsson logi

  • Belgingur
  • Rome and Reykjavík
View GitHub Profile
/**
* 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 {
@logi
logi / TestTest.kt
Created September 14, 2018 14:43
Why does the second test faile?
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"