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 {
      suite("clock") {
        testM("time is non-zero") {
          assertM(nanoTime, isGreaterThan(0))
        }
      }
    }
    Definition Classes
    zio
  • package mock

    The mock package contains testable versions of all the standard ZIO environment types through the MockClock, MockConsole, MockSystem, and MockRandom modules.

    The mock package contains testable versions of all the standard ZIO environment types through the MockClock, MockConsole, MockSystem, and MockRandom modules. See the documentation on the individual modules for more detail about using each of them.

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

    import zio.test.mock._
    
    myProgram.provideManaged(mockEnvironmentManaged)

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

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

    import zio.test.mock._
    
    myProgram.provideM(MockConsole.make(MockConsole.DefaultData))

    Finally, you can create a Mock object that implements the mock interface directly using the makeMock method. This can be useful when you want to access some mocking functionality without using the environment type.

    import zio.test.mock._
    
    for {
      mockRandom <- MockRandom.makeMock(MockRandom.DefaultData)
      n          <- mockRandom.nextInt
    } yield n

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

    Definition Classes
    test
  • package reflect
    Definition Classes
    test
  • AbstractRunnableSpec
  • Assertion
  • AssertionValue
  • BoolAlgebra
  • CheckVariants
  • DefaultRunnableSpec
  • DefaultTestReporter
  • DefaultTestRunner
  • ExecutionStrategy
  • FailureDetails
  • Gen
  • GenFailureDetails
  • GenZIO
  • RenderedResult
  • RunnableSpec
  • Sample
  • Sized
  • Spec
  • TestAnnotation
  • TestAnnotationMap
  • TestAspect
  • TestExecutor
  • TestFailure
  • TestLogger
  • TestPlatform
  • TestReporter
  • TestRunner
  • TestSuccess
  • TestTimeoutException
  • TimeoutVariants
  • ZSpecSyntax

object Assertion

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

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. final val anything: Assertion[Any]

    Makes a new assertion that always succeeds.

  5. final 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. final def assertion[A](name: String)(params: RenderParam*)(run: (=> A) => Boolean): Assertion[A]

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

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

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

  9. final def assertionRec[A](name: String)(params: RenderParam*)(run: (Assertion[A], => A) => AssertResult): Assertion[A]

    Makes a new Assertion from a pretty-printing and a function, passing the assertion itself to the specified function, so it can embed a recursive reference into the assert result.

  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. final def contains[A](element: A): Assertion[Iterable[A]]

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

  12. final def containsString(element: String): Assertion[String]

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

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

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

  14. final def endsWith(suffix: String): Assertion[String]

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

  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def equalTo[A](expected: A): Assertion[A]

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

  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. final def equalsIgnoreCase(other: String): Assertion[String]

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

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

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

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

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

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

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

  23. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. final 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))
  25. final 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

  26. final 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.

  27. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. final 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)
  29. final val isEmpty: Assertion[Iterable[Any]]

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

  30. final val isEmptyString: Assertion[String]

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

  31. final def isFalse: Assertion[Boolean]

    Makes a new assertion that requires a value be true.

  32. final def isGreaterThan[A](reference: A)(implicit arg0: Numeric[A]): Assertion[A]

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

  33. final def isGreaterThanEqualTo[A](reference: A)(implicit arg0: Numeric[A]): Assertion[A]

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

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

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

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

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

  37. final def isLessThan[A](reference: A)(implicit arg0: Numeric[A]): Assertion[A]

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

  38. final def isLessThanEqualTo[A](reference: A)(implicit arg0: Numeric[A]): Assertion[A]

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

  39. final val isNonEmpty: Assertion[Iterable[Any]]

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

  40. final val isNonEmptyString: Assertion[String]

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

  41. final val isNone: Assertion[Option[Any]]

    Makes a new assertion that requires a None value.

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

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

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

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

  44. final 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))
  45. final def isTrue: Assertion[Boolean]

    Makes a new assertion that requires a value be true.

  46. final def isUnit: Assertion[Any]

    Makes a new assertion that requires the value be unit.

  47. final def isWithin[A](min: A, max: A)(implicit arg0: Numeric[A]): Assertion[A]

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

  48. final def matchesRegex(regex: String): Assertion[String]

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

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

    Makes a new assertion that negates the specified assertion.

  51. final val nothing: Assertion[Any]

    Makes a new assertion that always fails.

  52. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  53. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  54. final def startsWith(prefix: String): Assertion[String]

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

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

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

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

    Returns a new assertion that requires the expression to throw.

  58. final 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)

  59. def toString(): String
    Definition Classes
    AnyRef → Any
  60. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  61. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  62. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  63. object Render
  64. object RenderParam

Inherited from AnyRef

Inherited from Any

Ungrouped