TestSystem

trait TestSystem extends System with Restorable

TestSystem supports deterministic testing of effects involving system properties. Internally, TestSystem maintains mappings of environment variables and system properties that can be set and accessed. No actual environment variables or system properties will be accessed or set as a result of these actions.

import zio.system
import zio.test.TestSystem

for {
 _      <- TestSystem.putProperty("java.vm.name", "VM")
 result <- system.property("java.vm.name")
} yield result == Some("VM")
Companion:
object
trait System
class Object
trait Matchable
class Any
class Test

Type members

Inherited classlikes

trait UnsafeAPI
Inherited from:
System

Value members

Abstract methods

def clearEnv(variable: String)(implicit trace: Trace): UIO[Unit]
def clearProperty(prop: String)(implicit trace: Trace): UIO[Unit]
def putEnv(name: String, value: String)(implicit trace: Trace): UIO[Unit]
def putProperty(name: String, value: String)(implicit trace: Trace): UIO[Unit]
def setLineSeparator(lineSep: String)(implicit trace: Trace): UIO[Unit]

Inherited methods

def env(variable: => String)(implicit trace: Trace): IO[SecurityException, Option[String]]
Inherited from:
System
def envOrElse(variable: => String, alt: => String)(implicit trace: Trace): IO[SecurityException, String]
Inherited from:
System
def envOrOption(variable: => String, alt: => Option[String])(implicit trace: Trace): IO[SecurityException, Option[String]]
Inherited from:
System
def envs(implicit trace: Trace): IO[SecurityException, Map[String, String]]
Inherited from:
System
def lineSeparator(implicit trace: Trace): UIO[String]
Inherited from:
System
def properties(implicit trace: Trace): IO[Throwable, Map[String, String]]
Inherited from:
System
def property(prop: => String)(implicit trace: Trace): IO[Throwable, Option[String]]
Inherited from:
System
def propertyOrElse(prop: => String, alt: => String)(implicit trace: Trace): IO[Throwable, String]
Inherited from:
System
def propertyOrOption(prop: => String, alt: => Option[String])(implicit trace: Trace): IO[Throwable, Option[String]]
Inherited from:
System
def save(implicit trace: Trace): UIO[UIO[Unit]]
Inherited from:
Restorable
Inherited from:
System