StubbedIOMethod0

org.scalamock.stubs.StubbedIOMethod0
class StubbedIOMethod0[R](delegate: StubbedMethod0[R]) extends StubbedMethod0[R]

Representation of stubbed method without arguments.

CatsEffectStubs interface provides implicit conversion from selected method to StubbedMethodIO0.

 trait Foo:
   def foo00(): String
   def fooIO: IO[Int]

 val foo = stub[Foo]

The default way of getting stub for such method - convert it to a function () => R.

Exclusively for IO - you can omit converting it to function

 val foo00Stubbed: StubbedMethod0[String] = () => foo.foo00()
 val fooIOStubbed: StubbedMethod0[IO[Int]] = foo.fooIO

Attributes

Graph
Supertypes
trait StubbedMethod0[R]
trait Order
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def asString: String

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

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

Attributes

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.

Attributes

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.

Attributes

def raisesErrorWith(ex: => Throwable)(implicit ev: IO[Nothing] <:< R): IO[Unit]

Allows raise error for method without arguments. Returns IO.

Allows raise error for method without arguments. Returns IO.

  for {
    _ <- foo.fooIO.failsWith(1)
  } yield ()

Attributes

def returns(f: => R): Unit

Allows to set result for method without arguments.

Allows to set result for method without arguments.

  (() => foo.foo00()).returns("result")
  foo.fooIO.returns(IO(1))

Attributes

def returnsIO(f: => R): IO[Unit]

Allows to set result for method without arguments. Returns IO.

Allows to set result for method without arguments. Returns IO.

  for {
    _ <- (() => foo.foo00()).returnsIO("result")
    _ <- foo.fooIO.returnsIO(IO(1))
  } yield ()

Attributes

def succeedsWith[RR](value: => RR)(implicit ev: IO[RR] <:< R): IO[Unit]

Allows to set success for method without arguments. Returns IO.

Allows to set success for method without arguments. Returns IO.

  for {
    _ <- foo.fooIO.succeedsWith(1)
  } yield ()

Attributes

def times: Int

Allows to get number of times method was executed.

Allows to get number of times method was executed.

  for {
    _ <- foo.fooIO.returnsIO(IO(1))
    _ <- foo.fooIO
    _ <- foo.fooIO
  } yield foo.fooIO.times == 2 // true

Attributes

def timesIO: IO[Int]

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

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

  for {
    _ <- foo.fooIO.returnsIO(IO(1))
    _ <- foo.fooIO
    _ <- foo.fooIO
    fooIOTimes <- foo.fooIO.timesIO
  } yield fooIOTimes == 2 // true

Attributes

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any