StubbedIOMethod

org.scalamock.stubs.StubbedIOMethod
class StubbedIOMethod[A, R](delegate: StubbedMethod[A, R]) extends StubbedMethod[A, R]

Same as StubbedMethod, but with additional IO methods.

Attributes

Graph
Supertypes
trait StubbedMethod[A, R]
trait Order
class Object
trait Matchable
class Any

Members list

Type members

Inherited types

type Args = A

Attributes

Inherited from:
StubbedMethod
type Result = R

Attributes

Inherited from:
StubbedMethod

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 calls: List[Args]

Allows to get arguments with which method was executed.

Allows to get arguments with which method was executed.

Scala 3

 foo.foo.returns(_ => 5)
 foo.foo(1)
 foo.foo(100)

 foo.foo.calls // List(1, 100)

Scala 2

  (foo.foo _).returns(_ => 5)
  foo.foo(1)
  foo.foo(100)

 (foo.foo _).calls // List(1, 100)

Attributes

def callsIO: IO[List[Args]]
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.

Scala 3

 foo.foo.returns(_ => 5)
 foo.fooBar.returns(_ => "bar")
 foo.foo(1)
 foo.fooBar(true, "bar")

 foo.foo.isAfter(foo.fooBar) // false

Scala 2

  (foo.foo _).returns(_ => 5)
  (foo.fooBar _).returns(_ => "bar")
  foo.foo(1)
  foo.fooBar(true, "bar")

 (foo.foo _).isAfter(foo.fooBar _) // false

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.

Scala 3

 foo.foo.returns(_ => 5)
 foo.fooBar.returns(_ => "bar")
 foo.foo(1)
 foo.fooBar(true, "bar")

 foo.foo.isBefore(foo.fooBar) // true

Scala 2

  (foo.foo _).returns(_ => 5)
  (foo.fooBar _).returns(_ => "bar")
  foo.foo(1)
  foo.fooBar(true, "bar")

 (foo.foo _).isBefore(foo.fooBar _) // true

Attributes

def returns(f: Args => Result): Unit

Allows to set result for method with arguments.

Allows to set result for method with arguments.

Scala 3

 foo.fooBar.returns:
   case (true, "bar") => "true"
   case _ => "false

Scala 2

 (foo.fooBar _).returns {
   case (true, "bar") => "true"
   case _ => "false"
 }

Attributes

def returnsIO(f: Args => Result): IO[Unit]
def times: Int

Allows to get number of times method was executed.

Allows to get number of times method was executed.

Scala 3

 foo.foo.returns(_ => 5)
 foo.foo(1)

 foo.foo.times // 1

Scala 2

  (foo.foo _).returns(_ => 5)
  foo.foo(1)

  (foo.foo _).times // 1

Attributes

def timesIO: IO[Int]
def timesIO(args: Args): IO[Int]
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

Inherited methods

final def times(args: Args): 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.

Scala 3

 foo.foo.returns(_ => 5)
 foo.foo(1)

 foo.foo.times(1) // 1
 foo.foo.times(100) // 0

Scala 2

  (foo.foo _).returns(_ => 5)
  foo.foo(1)

 (foo.foo _).times(1) // 1
 (foo.foo _).times(100) // 0

Attributes

Inherited from:
StubbedMethod