Packages

  • package root
    Definition Classes
    root
  • package zio
    Definition Classes
    root
  • package test

    _ZIO Test_ is a featherweight testing library for effectful programs.

    _ZIO Test_ is a featherweight testing library for effectful programs.

    The library imagines every spec as an ordinary immutable value, providing tremendous potential for composition. Thanks to tight integration with ZIO, specs can use resources (including those requiring disposal), have well- defined linear and parallel semantics, and can benefit from a host of ZIO combinators.

    import zio.test._
    import zio.clock.nanoTime
    import Assertion.isGreaterThan
    
    object MyTest extends DefaultRunnableSpec {
      def spec = suite("clock")(
        testM("time is non-zero") {
          assertM(nanoTime)(isGreaterThan(0))
        }
      )
    }
    Definition Classes
    zio
  • package environment

    The environment package contains testable versions of all the standard ZIO environment types through the TestClock, TestConsole, TestSystem, and TestRandom modules.

    The environment package contains testable versions of all the standard ZIO environment types through the TestClock, TestConsole, TestSystem, and TestRandom modules. See the documentation on the individual modules for more detail about using each of them.

    If you are using ZIO Test and extending RunnableSpec a TestEnvironment containing all of them will be automatically provided to each of your tests. Otherwise, the easiest way to use the test implementations in ZIO Test is by providing the TestEnvironment to your program.

    import zio.test.environment._
    
    myProgram.provideLayer(testEnvironment)

    Then all environmental effects, such as printing to the console or generating random numbers, will be implemented by the TestEnvironment and will be fully testable. When you do need to access the "live" environment, for example to print debugging information to the console, just use the live combinator along with the effect as your normally would.

    If you are only interested in one of the test implementations for your application, you can also access them a la carte through the make method on each module. Each test module requires some data on initialization. Default data is included for each as DefaultData.

    import zio.test.environment._
    
    myProgram.provideM(TestConsole.make(TestConsole.DefaultData))

    Finally, you can create a Test object that implements the test interface directly using the makeTest method. This can be useful when you want to access some testing functionality without using the environment type.

    import zio.test.environment._
    
    for {
      testRandom <- TestRandom.makeTest(TestRandom.DefaultData)
      n          <- testRandom.nextInt
    } yield n

    This can also be useful when you are creating a more complex environment to provide the implementation for test services that you mix in.

    Definition Classes
    test
  • package mock
    Definition Classes
    test
  • package poly
    Definition Classes
    test
  • package reflect
    Definition Classes
    test
  • AbstractRunnableSpec
  • Annotations
  • Assertion
  • AssertionValue
  • AssertionVariants
  • BoolAlgebra
  • BoolAlgebraM
  • CheckVariants
  • CompileVariants
  • DefaultRunnableSpec
  • DefaultTestReporter
  • Eql
  • ExecutionStrategy
  • FailureDetails
  • FailureRenderer
  • FunctionVariants
  • Gen
  • GenFailureDetails
  • GenZIO
  • RenderedResult
  • RunnableSpec
  • Sample
  • Sized
  • Spec
  • Summary
  • SummaryBuilder
  • TestAnnotation
  • TestAnnotationMap
  • TestAnnotationRenderer
  • TestArgs
  • TestAspect
  • TestExecutor
  • TestFailure
  • TestLogger
  • TestPlatform
  • TestReporter
  • TestRunner
  • TestSuccess
  • TestTimeoutException
  • TestVersion
  • TimeVariants
  • TimeoutVariants
  • ZTest

object Assertion extends AssertionVariants

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Assertion
  2. AssertionVariants
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait Render extends AnyRef

    Render captures both the name of an assertion as well as the parameters to the assertion combinator for pretty-printing.

  2. sealed trait RenderParam extends AnyRef

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val anything: Assertion[Any]

    Makes a new assertion that always succeeds.

  5. def approximatelyEquals[A](reference: A, tolerance: A)(implicit arg0: Numeric[A]): Assertion[A]

    Makes a new assertion that requires a given numeric value to match a value with some tolerance.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def assertion[A](name: String)(params: RenderParam*)(run: (=> A) => Boolean): Assertion[A]

    Makes a new Assertion from a pretty-printing and a function.

  8. def assertionDirect[A](name: String)(params: RenderParam*)(run: (=> A) => AssertResult): Assertion[A]

    Makes a new Assertion from a pretty-printing and a function.

  9. def assertionM[R, E, A](name: String)(params: RenderParam*)(run: (=> A) => ZIO[Any, Nothing, Boolean]): Assertion[A]

    Makes a new Assertion from a pretty-printing and a function.

  10. def assertionRec[A, B](name: String)(params: RenderParam*)(assertion: Assertion[B])(get: (=> A) => Option[B], orElse: (AssertionValue) => AssertResult = BoolAlgebraM.failure): Assertion[A]

    Makes a new Assertion[A] from a pretty-printing, a function (=> A) => Option[B], and an Assertion[B].

    Makes a new Assertion[A] from a pretty-printing, a function (=> A) => Option[B], and an Assertion[B]. If the result of applying the function to a given value is Some[B], the Assertion[B] will be applied to the resulting value to determine if the assertion is satisfied. The result of the Assertion[B] and any assertions it is composed from will be recursively embedded in the assert result. If the result of the function is None the orElse parameter will be used to determine whether the assertion is satisfied.

  11. def assertionRecM[R, E, A, B](name: String)(params: RenderParam*)(assertion: Assertion[B])(get: (=> A) => ZIO[Any, Nothing, Option[B]], orElse: (AssertionValue) => AssertResult = BoolAlgebraM.failure): Assertion[A]
  12. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  13. def contains[A](element: A): Assertion[Iterable[A]]

    Makes a new assertion that requires an iterable contain the specified element.

    Makes a new assertion that requires an iterable contain the specified element. See Assertion.exists if you want to require an iterable to contain an element satisfying an assertion.

  14. def containsCause[E](cause: Cause[E]): Assertion[Cause[E]]

    Makes a new assertion that requires a Cause contain the specified cause.

  15. def containsString(element: String): Assertion[String]

    Makes a new assertion that requires a substring to be present.

  16. def dies(assertion: Assertion[Throwable]): Assertion[Exit[Any, Any]]

    Makes a new assertion that requires an exit value to die.

  17. def endsWith[A](suffix: Seq[A]): Assertion[Seq[A]]

    Makes a new assertion that requires a given string to end with the specified suffix.

  18. def endsWithString(suffix: String): Assertion[String]

    Makes a new assertion that requires a given string to end with the specified suffix.

  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def equalTo[A, B](expected: A)(implicit eql: Eql[A, B]): Assertion[B]

    Makes a new assertion that requires a value equal the specified value.

    Makes a new assertion that requires a value equal the specified value.

    Definition Classes
    AssertionVariants
  21. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  22. def equalsIgnoreCase(other: String): Assertion[String]

    Makes a new assertion that requires a given string to equal another ignoring case

  23. def exists[A](assertion: Assertion[A]): Assertion[Iterable[A]]

    Makes a new assertion that requires an iterable contain an element satisfying the given assertion.

    Makes a new assertion that requires an iterable contain an element satisfying the given assertion. See Assertion.contains if you only need an iterable to contain a given element.

  24. def fails[E](assertion: Assertion[E]): Assertion[Exit[E, Any]]

    Makes a new assertion that requires an exit value to fail.

  25. def failsCause[E](assertion: Assertion[Cause[E]]): Assertion[Exit[E, Any]]

    Makes a new assertion that requires an exit value to fail with a cause that meets the specified assertion.

  26. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  27. def forall[A](assertion: Assertion[A]): Assertion[Iterable[A]]

    Makes a new assertion that requires an iterable contain only elements satisfying the given assertion.

  28. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. def hasAt[A](pos: Int)(assertion: Assertion[A]): Assertion[Seq[A]]

    Makes a new assertion that requires a sequence to contain an element satisfying the given assertion on the given position

  30. def hasField[A, B](name: String, proj: (A) => B, assertion: Assertion[B]): Assertion[A]

    Makes a new assertion that focuses in on a field in a case class.

    Makes a new assertion that focuses in on a field in a case class.

    hasField("age", _.age, within(0, 10))
  31. def hasFirst[A](assertion: Assertion[A]): Assertion[Iterable[A]]

    Makes a new assertion that requires an iterable to contain the first element satisfying the given assertion

  32. def hasLast[A](assertion: Assertion[A]): Assertion[Iterable[A]]

    Makes a new assertion that requires an iterable to contain the last element satisfying the given assertion

  33. def hasMessage(message: Assertion[String]): Assertion[Throwable]

    Makes a new assertion that requires an exception to have a certain message.

  34. def hasSameElements[A](other: Iterable[A]): Assertion[Iterable[A]]

    Makes a new assertion that requires an Iterable to have the same elements as the specified Iterable, though not necessarily in the same order

  35. def hasSize[A](assertion: Assertion[Int]): Assertion[Iterable[A]]

    Makes a new assertion that requires the size of an iterable be satisfied by the specified assertion.

  36. def hasSizeString(assertion: Assertion[Int]): Assertion[String]

    Makes a new assertion that requires the size of a string be satisfied by the specified assertion.

  37. def hasThrowableCause(cause: Assertion[Throwable]): Assertion[Throwable]

    Makes a new assertion that requires an exception to have a certain cause.

  38. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  39. def isCase[Sum, Proj](termName: String, term: (Sum) => Option[Proj], assertion: Assertion[Proj]): Assertion[Sum]

    Makes a new assertion that requires the sum type be a specified term.

    Makes a new assertion that requires the sum type be a specified term.

    isCase("Some", Some.unapply, anything)
  40. val isEmpty: Assertion[Iterable[Any]]

    Makes a new assertion that requires an Iterable to be empty.

  41. val isEmptyString: Assertion[String]

    Makes a new assertion that requires a given string to be empty.

  42. def isFalse: Assertion[Boolean]

    Makes a new assertion that requires a value be true.

  43. def isGreaterThan[A](reference: A)(implicit ord: Ordering[A]): Assertion[A]

    Makes a new assertion that requires the value be greater than the specified reference value.

  44. def isGreaterThanEqualTo[A](reference: A)(implicit ord: Ordering[A]): Assertion[A]

    Makes a new assertion that requires the value be greater than or equal to the specified reference value.

  45. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  46. def isInterrupted: Assertion[Exit[Any, Any]]

    Makes a new assertion that requires an exit value to be interrupted.

  47. def isLeft[A](assertion: Assertion[A]): Assertion[Either[A, Any]]

    Makes a new assertion that requires a Left value satisfying a specified assertion.

  48. def isLessThan[A](reference: A)(implicit ord: Ordering[A]): Assertion[A]

    Makes a new assertion that requires the value be less than the specified reference value.

  49. def isLessThanEqualTo[A](reference: A)(implicit ord: Ordering[A]): Assertion[A]

    Makes a new assertion that requires the value be less than or equal to the specified reference value.

  50. val isNonEmpty: Assertion[Iterable[Any]]

    Makes a new assertion that requires an Iterable to be non empty.

  51. val isNonEmptyString: Assertion[String]

    Makes a new assertion that requires a given string to be non empty

  52. val isNone: Assertion[Option[Any]]

    Makes a new assertion that requires a None value.

  53. val isNull: Assertion[Any]

    Makes a new assertion that requires a null value.

  54. def isRight[A](assertion: Assertion[A]): Assertion[Either[Any, A]]

    Makes a new assertion that requires a Right value satisfying a specified assertion.

  55. def isSome[A](assertion: Assertion[A]): Assertion[Option[A]]

    Makes a new assertion that requires a Some value satisfying the specified assertion.

  56. def isSubtype[A](assertion: Assertion[A])(implicit C: ClassTag[A]): Assertion[Any]

    Makes an assertion that requires a value have the specified type.

    Makes an assertion that requires a value have the specified type.

    Example:

    assert(Duration.fromNanos(1), isSubtype[Duration.Finite](Assertion.anything))
  57. def isTrue: Assertion[Boolean]

    Makes a new assertion that requires a value be true.

  58. val isUnit: Assertion[Unit]

    Makes a new assertion that requires the value be unit.

  59. def isWithin[A](min: A, max: A)(implicit ord: Ordering[A]): Assertion[A]

    Returns a new assertion that requires a value to fall within a specified min and max (inclusive).

  60. def matchesRegex(regex: String): Assertion[String]

    Makes a new assertion that requires a given string to match the specified regular expression.

  61. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  62. def not[A](assertion: Assertion[A]): Assertion[A]

    Makes a new assertion that negates the specified assertion.

  63. val nothing: Assertion[Any]

    Makes a new assertion that always fails.

  64. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  65. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  66. def startsWith[A](prefix: Seq[A]): Assertion[Seq[A]]

    Makes a new assertion that requires a given sequence to start with the specified prefix.

  67. def startsWithString(prefix: String): Assertion[String]

    Makes a new assertion that requires a given string to start with a specified prefix

  68. def succeeds[A](assertion: Assertion[A]): Assertion[Exit[Any, A]]

    Makes a new assertion that requires an exit value to succeed.

  69. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  70. def throws[A](assertion: Assertion[Throwable]): Assertion[A]

    Returns a new assertion that requires the expression to throw.

  71. def throwsA[E](implicit arg0: ClassTag[E]): Assertion[Any]

    Returns a new assertion that requires the expression to throw an instance of given type (or its subtype).

  72. def toString(): String
    Definition Classes
    AnyRef → Any
  73. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  74. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  75. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  76. object Render
  77. object RenderParam

Inherited from AssertionVariants

Inherited from AnyRef

Inherited from Any

Ungrouped