TestSystem

zio.test.TestSystem
See theTestSystem companion object
trait TestSystem extends System, 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")

Attributes

Companion
object
Graph
Supertypes
trait Restorable
trait System
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Test

Members list

Type members

Inherited classlikes

trait UnsafeAPI

Attributes

Inherited from:
System
Supertypes
class Object
trait Matchable
class Any

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]]

Attributes

Inherited from:
System
def envOrElse(variable: => String, alt: => String)(implicit trace: Trace): IO[SecurityException, String]

Attributes

Inherited from:
System
def envOrOption(variable: => String, alt: => Option[String])(implicit trace: Trace): IO[SecurityException, Option[String]]

Attributes

Inherited from:
System
def envs(implicit trace: Trace): IO[SecurityException, Map[String, String]]

Attributes

Inherited from:
System
def lineSeparator(implicit trace: Trace): UIO[String]

Attributes

Inherited from:
System
def properties(implicit trace: Trace): IO[Throwable, Map[String, String]]

Attributes

Inherited from:
System
def property(prop: => String)(implicit trace: Trace): IO[Throwable, Option[String]]

Attributes

Inherited from:
System
def propertyOrElse(prop: => String, alt: => String)(implicit trace: Trace): IO[Throwable, String]

Attributes

Inherited from:
System
def propertyOrOption(prop: => String, alt: => Option[String])(implicit trace: Trace): IO[Throwable, Option[String]]

Attributes

Inherited from:
System
def save(implicit trace: Trace): UIO[UIO[Unit]]

Attributes

Inherited from:
Restorable

Attributes

Inherited from:
System