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. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. 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
  15. 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
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. 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
  21. 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 ()
  22. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  23. 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
  24. final def times(args: A): Int
    Definition Classes
    StubbedMethod
  25. 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
  26. 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
  27. def toString(): String
    Definition Classes
    StubbedZIOMethod → AnyRef → Any
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. 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