Packages

c

org.scalamock.stubs

StubbedZIOMethod

class StubbedZIOMethod[A, R] extends StubbedMethod[A, R]

Representation of stubbed method with arguments.

ZIOStubs interface provides implicit conversion from selected method to StubbedMethodZIO.

trait Foo:
  def foo(x: Int): UIO[String]
  def bar(x: Int, y: String): IO[String, Int]

val foo = stub[Foo]

Scala 3

val fooStubbed: StubbedMethod[Int, UIO[String]] = foo.foo
val barStubbed: StubbedMethod[(Int, String), IO[String, Int]] = foo.bar

Scala 2

val fooStubbed: StubbedMethod[Int, UIO[String]] = foo.foo _
val barStubbed: StubbedMethod[(Int, String), IO[String, Int]] = foo.bar _
Linear Supertypes
StubbedMethod[A, R], Order, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StubbedZIOMethod
  2. StubbedMethod
  3. Order
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new StubbedZIOMethod(delegate: StubbedMethod[A, R])

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 def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def asString: String

    Returns string representation of method.

    Returns string representation of method. Representation currently depends on scala version.

    Definition Classes
    StubbedZIOMethod → Order
  6. def calls: List[A]

    Allows to get arguments with which method was executed.

    Allows to get arguments with which method was executed. Returns multiple arguments as tuple. One list item per call.

    Scala 3

    for {
      _ <- foo.bar.returnsZIO(_ => ZIO.succeed(5))
      _ <- foo.bar(1, "foo")
      _ <- foo.bar(2, "bar")
    } yield foo.bar.calls == List((1, "foo"), (2, "bar")) // true

    Scala 2

    for {
      _ <- (foo.bar _).returnsZIO(_ => ZIO.succeed(5))
      _ <- foo.bar(1, "foo")
      _ <- foo.bar(2, "bar")
    } yield (foo.bar _).calls == List((1, "foo"), (2, "bar")) // true
    Definition Classes
    StubbedZIOMethod → StubbedMethod
  7. def callsZIO: UIO[List[A]]

    Allows to get arguments with which method was executed.

    Allows to get arguments with which method was executed. Returns ZIO

    Returns multiple arguments as tuple. One list item per call.

    Scala 3

    for {
      _ <- foo.bar.returnsZIO(_ => ZIO.succeed(5))
      _ <- foo.bar(1, "foo")
      _ <- foo.bar(2, "bar")
      calls <- foo.bar.callsZIO
    } yield calls == List((1, "foo"), (2, "bar")) // true

    Scala 2

    for {
      _ <- (foo.bar _).returnsZIO(_ => ZIO.succeed(5))
      _ <- foo.bar(1, "foo")
      _ <- foo.bar(2, "bar")
      calls <- (foo.bar _).callsZIO
    } yield calls == List((1, "foo"), (2, "bar")) // true
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  9. def diesWith(ex: ⇒ Throwable)(implicit ev: <:<[UIO[Nothing], R]): UIO[Unit]

    Allows set die result for method with arguments.

    Allows set die result for method with arguments. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.diesWith(new Exception("foo"))
    yield ()

    Scala 2

    for {
      _ <- (foo.bar _).diesWith(new Exception("foo"))
    } yield ()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def failsWith[RR](result: RR)(implicit ev: <:<[IO[RR, Nothing], R]): UIO[Unit]

    Allows set fail result for method with arguments.

    Allows set fail result for method with arguments. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.failsWith("foo")
    yield ()

    Scala 2

    for {
      _ <- (foo.bar _).failsWith("foo")
    } yield ()
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def isAfter(other: Order)(implicit callLog: CallLog): Boolean

    Returns true if this method was called after other method.

    Returns true if this method was called after other method.

    Definition Classes
    StubbedZIOMethod → Order
  17. def isBefore(other: Order)(implicit callLog: CallLog): Boolean

    Returns true if this method was called before other method.

    Returns true if this method was called before other method.

    Definition Classes
    StubbedZIOMethod → Order
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. def returns(f: (A) ⇒ R): Unit

    Allows to set result for method with arguments.

    Allows to set result for method with arguments.

    Scala 3

    foo.bar.returns((x, y) => ZIO.succeed(1))

    Scala 2

    (foo.bar _).returns((x, y) => ZIO.succeed(1))
    Definition Classes
    StubbedZIOMethod → StubbedMethod
  23. def returnsWith(value: ⇒ R): Unit

    Allows to set result for method without arguments.

    Allows to set result for method without arguments.

    Scala 3

    foo.bar.returnsWith(ZIO.succeed(1))

    Scala 2

    (foo.bar _).returnsWith(ZIO.succeed(1))
    Definition Classes
    StubbedZIOMethod → StubbedMethod
  24. def returnsZIO(f: (A) ⇒ R): UIO[Unit]

    Allows to set result for method with arguments.

    Allows to set result for method with arguments. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.returnsZIO((x, y) => ZIO.succeed(1))
    yield ()

    Scala 2

    for {
      _ <- (foo.bar _).returnsZIO((x, y) => ZIO.succeed(1))
    } yield ()
  25. def returnsZIOWith(value: ⇒ R): UIO[Unit]

    Allows to set result for method with arguments.

    Allows to set result for method with arguments. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.returnsZIOWith(ZIO.succeed(1))
    yield ()

    Scala 2

    for {
      _ <- (foo.bar _).returnsZIOWith(ZIO.succeed(1))
    } yield ()
  26. def succeedsWith[RR](result: RR)(implicit ev: <:<[IO[Nothing, RR], R]): UIO[Unit]

    Allows to set success for method with arguments.

    Allows to set success for method with arguments. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.succeedsWith(1)
    yield ()

    Scala 2

    for {
      _ <- (foo.bar _).succeedsWith(1)
    } yield ()
  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def times: Int

    Allows to get number of times method was executed.

    Allows to get number of times method was executed.

    for {
      _ <- foo.fooIO.returnsZIO(ZIO.succeed(1))
      _ <- foo.fooIO.repeatN(10)
    } yield foo.fooIO.times == 11 // true
    Definition Classes
    StubbedZIOMethod → StubbedMethod
  29. final def times(args: A): Int
    Definition Classes
    StubbedMethod
  30. def timesZIO(args: A): UIO[Int]

    Allows to get number of times method was executed with specific arguments.

    Allows to get number of times method was executed with specific arguments. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.returnsZIO(_ => ZIO.succeed(1))
      _ <- foo.bar(1, "foo").repeatN(10)
      barTimes <- foo.bar.timesZIO((1, "foo"))
    yield barTimes == 11 // true

    Scala 2

    for {
      _ <- (foo.bar _).returnsZIO(_ => ZIO.succeed(1))
      _ <- foo.bar(1, "foo").repeatN(10)
      barTimes <- (foo.bar _).timesZIO((1, "foo"))
    } yield barTimes == 11 // true
  31. def timesZIO: UIO[Int]

    Allows to get number of times method was executed.

    Allows to get number of times method was executed. Returns ZIO

    Scala 3

    for
      _ <- foo.bar.returnsZIO(_ => ZIO.succeed(1))
      _ <- foo.bar(1, "foo").repeatN(10)
      barTimes <- foo.bar.timesZIO
    yield barTimes == 11 // true

    Scala 2

    for {
      _ <- (foo.bar _).returnsZIO(_ => ZIO.succeed(1))
      _ <- foo.bar(1, "foo").repeatN(10)
      barTimes <- (foo.bar _).timesZIO
    } yield barTimes == 11 // true
  32. def toString(): String
    Definition Classes
    StubbedZIOMethod → AnyRef → Any
  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from StubbedMethod[A, R]

Inherited from Order

Inherited from AnyRef

Inherited from Any

Ungrouped