object TestSystem extends Serializable
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.environment.TestSystem for { _ <- TestSystem.putProperty("java.vm.name", "VM") result <- system.property("java.vm.name") } yield result == Some("VM")
- Alphabetic
- By Inheritance
- TestSystem
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class Data(properties: Map[String, String] = Map.empty, envs: Map[String, String] = Map.empty, lineSeparator: String = "\n") extends Product with Serializable
The state of the
TestSystem
. - trait Service extends Restorable
- final case class Test(systemState: Ref[Data]) extends system.System.Service with Service with Product with Serializable
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val DefaultData: Data
The default initial state of the
TestSystem
with no environment variable or system property mappings and the system line separator set to the new line character. - val any: ZLayer[System with TestSystem, Nothing, System with TestSystem]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clearEnv(variable: => String): ZIO[TestSystem, Nothing, Unit]
Accesses a
TestSystem
instance in the environment and clears the mapping of environment variables. - def clearProperty(prop: => String): ZIO[TestSystem, Nothing, Unit]
Accesses a
TestSystem
instance in the environment and clears the mapping of system properties. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val default: Layer[Nothing, System with TestSystem]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def live(data: Data): Layer[Nothing, System with TestSystem]
Constructs a new
TestSystem
with the specified initial state.Constructs a new
TestSystem
with the specified initial state. This can be useful for providing the required environment to an effect that requires aConsole
, such as withZIO#provide
. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def putEnv(name: => String, value: => String): ZIO[TestSystem, Nothing, Unit]
Accesses a
TestSystem
instance in the environment and adds the specified name and value to the mapping of environment variables. - def putProperty(name: => String, value: => String): ZIO[TestSystem, Nothing, Unit]
Accesses a
TestSystem
instance in the environment and adds the specified name and value to the mapping of system properties. - val save: ZIO[TestSystem, Nothing, UIO[Unit]]
Accesses a
TestSystem
instance in the environment and saves the system state in an effect which, when run, will restore theTestSystem
to the saved state - def setLineSeparator(lineSep: => String): ZIO[TestSystem, Nothing, Unit]
Accesses a
TestSystem
instance in the environment and sets the line separator to the specified value. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()