trait StubbedMethod[A, R] extends Order
Representation of stubbed method with arguments.
Stubs interface provides implicit conversions from selected method to StubbedMethod.
trait Foo: def foo(x: Int): Int def fooBar(bar: Boolean, baz: String): String val foo = stub[Foo]
Scala 2
val fooStubbed: StubbedMethod[Int, Int] = foo.foo _ val fooBarStubbed: StubbedMethod[(Boolean, String), String] = foo.fooBar _
Scala 3
val fooStubbed: StubbedMethod[Int, Int] = foo.foo val fooBarStubbed: StubbedMethod[(Boolean, String), String] = foo.fooBar
- Alphabetic
- By Inheritance
- StubbedMethod
- Order
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
asString: String
Returns string representation of method.
Returns string representation of method. Representation currently depends on scala version.
- Definition Classes
- Order
-
abstract
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
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)
-
abstract
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
- Definition Classes
- Order
-
abstract
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
- Definition Classes
- Order
-
abstract
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.fooBar.returns: case (true, "bar") => "true" case _ => "false
Scala 2
(foo.fooBar _).returns { case (true, "bar") => "true" case _ => "false" }
-
abstract
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(x => 5) foo.foo(1) foo.foo.times // 1
Scala 2
(foo.foo _).returns(_ => 5) foo.foo(1) (foo.foo _).times // 1
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
times(args: A): 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
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
ScalaMock
This is the documentation for ScalaMock
For an overview, see org.scalamock.