public class SpecSystemExitListener
Will replace the SecurityManager used by the Java runtime
with a class NoExitSecurityManager that will throw an exception
if System.exit() is invoked. This exception can then be
tested for with shouldThrow().
After the spec has completed, the original security manager will be set.
To use this, override listeners() in your Spec class.
Note: This listener is only suitable for use if parallelism is set to 1 (the default) otherwise a race condition could occur.
If you want to change the security manager for the entire
project, then use the alternative class SystemExitListener
| Modifier and Type | Field and Description |
|---|---|
static SpecSystemExitListener |
INSTANCE
Will replace the SecurityManager used by the Java runtime
with a
class NoExitSecurityManager that will throw an exception
if System.exit() is invoked. This exception can then be
tested for with shouldThrow(). |
| Modifier and Type | Method and Description |
|---|---|
void |
afterSpec(io.kotlintest.Spec spec) |
void |
beforeSpec(io.kotlintest.Spec spec) |
public static SpecSystemExitListener INSTANCE
Will replace the SecurityManager used by the Java runtime
with a class NoExitSecurityManager that will throw an exception
if System.exit() is invoked. This exception can then be
tested for with shouldThrow().
After the spec has completed, the original security manager will be set.
To use this, override listeners() in your Spec class.
Note: This listener is only suitable for use if parallelism is set to 1 (the default) otherwise a race condition could occur.
If you want to change the security manager for the entire
project, then use the alternative class SystemExitListener