kotest-extensions / io.kotest.extensions.system

Package io.kotest.extensions.system

Types

NoExitSecurityManager

An implementation of SecurityManager that throws a SystemExitException exception whenever System.exit(int) is invoked.

class NoExitSecurityManager : SecurityManager

NoSystemErrListener

A TestListener that throws an error if anything is written to standard err.

object NoSystemErrListener : TestListener

NoSystemOutListener

A TestListener that throws an error if anything is written to standard out.

object NoSystemOutListener : TestListener

OverrideMode

sealed class OverrideMode

SecurityManagerListener

abstract class SecurityManagerListener

SecurityManagerProjectListener

Overrides System Security Manager with specified securityManager

class SecurityManagerProjectListener : SecurityManagerListener, ProjectListener

SecurityManagerTestListener

Overrides System Security Manager with specified securityManager

class SecurityManagerTestListener : SecurityManagerListener, TestListener

SpecSystemExitListener

Will replace the SecurityManager used by the Java runtime with a NoExitSecurityManager that will throw an exception if System.exit() is invoked. This exception can then be tested for with shouldThrow().

object SpecSystemExitListener : TestListener

SystemEnvironmentListener

abstract class SystemEnvironmentListener

SystemEnvironmentProjectListener

Modifies System Environment with chosen keys and values

class SystemEnvironmentProjectListener : SystemEnvironmentListener, ProjectListener

SystemEnvironmentTestListener

Modifies System Environment with chosen keys and values

class SystemEnvironmentTestListener : SystemEnvironmentListener, TestListener

SystemErrWireListener

A Kotest listener that facilities testing writes to standard err, by copying any data written to standard err to an internal buffer.

class SystemErrWireListener : TestListener

SystemExitListener

Will replace the SecurityManager used by the Java runtime with a NoExitSecurityManager that will throw an exception if System.exit() is invoked. This exception can then be tested for with shouldThrow().

object SystemExitListener : TestListener

SystemOutWireListener

A Kotest listener that facilities testing writes to standard out, by redirecting any data written to standard out to an internal buffer.

class SystemOutWireListener : TestListener

SystemPropertyListener

abstract class SystemPropertyListener

SystemPropertyProjectListener

Changes System Properties with chosen keys and values

class SystemPropertyProjectListener : SystemPropertyListener, ProjectListener

SystemPropertyTestListener

Changes System Properties with chosen keys and values

class SystemPropertyTestListener : SystemPropertyListener, TestListener

Exceptions

SystemErrWriteException

class SystemErrWriteException : RuntimeException

SystemExitException

class SystemExitException : RuntimeException

SystemOutWriteException

class SystemOutWriteException : RuntimeException

Functions

captureStandardErr

A wrapper function that captures any writes to standard error.

fun captureStandardErr(fn: () -> Unit): String

captureStandardOut

A wrapper function that captures any writes to standard out.

fun captureStandardOut(fn: () -> Unit): String

withEnvironment

Modifies System Environment with chosen key and value

fun <T> withEnvironment(key: String, value: String?, mode: OverrideMode = SetOrError, block: () -> T): T
fun <T> withEnvironment(environment: Pair<String, String?>, mode: OverrideMode = SetOrError, block: () -> T): T

Modifies System Environment with chosen keys and values

fun <T> withEnvironment(environment: Map<String, String?>, mode: OverrideMode = SetOrError, block: () -> T): T

withSecurityManager

Replaces System Security Manager with securityManager

fun <T> withSecurityManager(securityManager: SecurityManager?, block: () -> T): T

withSystemProperties

Changes System Properties with chosen key and value

fun <T> withSystemProperties(pair: Pair<String, String?>, mode: OverrideMode = SetOrError, block: () -> T): T

Changes System Properties with chosen properties

fun <T> withSystemProperties(props: Properties, mode: OverrideMode = SetOrError, block: () -> T): T

Changes System Properties with chosen keys and values

fun <T> withSystemProperties(props: Map<String, String?>, mode: OverrideMode = SetOrError, block: () -> T): T

withSystemProperty

Changes System Properties with chosen key and value

fun <T> withSystemProperty(key: String, value: String?, mode: OverrideMode = SetOrError, block: () -> T): T