package mockito
- Alphabetic
- Public
- All
Type Members
- trait ArgThat extends AnyRef
-
class
ArgumentCapture[T] extends AnyRef
This class encapsulates an ArgumentCaptor
-
trait
CalledMatchers extends NumberOfTimes with FunctionArguments with TheMockitoMocker with Expectations
This trait provides methods to declare expectations on mock calls:
This trait provides methods to declare expectations on mock calls:
there was one(mockedList).get(0) there was no(mockedList).get(0) there was two(mockedList).get(0) there was three(mockedList).get(0) there was 4.times(mockedList).get(0) there was atLeastOne(mockedList).get(0) there was atLeastTwo(mockedList).get(0) there was atLeastThree(mockedList).get(0) there was atLeast(4)(mockedList).get(0) there was atMostOne(mockedList).get(0) there was atMostTwo(mockedList).get(0) there was atMostThree(mockedList).get(0) there was atMost(4)(mockedList).get(0) It is also possible to use a different wording: there were two(mockedList).get(0) got { two(mockedList).get(0) }
-
trait
CapturedArgument extends AnyRef
Syntactic sugar on top of the ArgumentCaptor API to avoid using classOf and an explicit call to capture()
- trait FunctionArguments extends FunctionArgumentsLowImplicits
-
trait
FunctionArgumentsLowImplicits extends ArgThat with Expectations
This trait allows to specify functions as arguments in mocked methods.
This trait allows to specify functions as arguments in mocked methods.
It uses a pair of (arguments, expected result) to specify what was the passed function:
function2.call((i:Int, d: Double) => (i + d).toString) there was one(function2).call((1, 3.0) -> "4.0")
anyFunctionN will just match any function with n arguments
-
case class
IgnoreStubs(mocks: Seq[AnyRef]) extends Product with Serializable
This class encapsulate mocks which must have their stubbed methods ignored in verification methods
-
trait
MockitoFunctions extends TheMockitoMocker
shortcuts to standard Mockito functions
-
trait
MockitoMatchers extends ArgThat
Mockito Matchers for the most common types
-
trait
MockitoStubs extends MocksCreation with MockitoStubsLowerImplicits
This trait provides functionalities to declare stub values on method calls.
This trait provides functionalities to declare stub values on method calls.
Usage:
mockedList.get(0) returns "one" mockedList.get(0) returns ("one", "two") mockedList.get(0) throws new Exception("unexpected") mockedList.get(0) answers ( i => "value " + i.toString ) mockedList.get(any) responds { case i: Int => (i + 1).toString }
It is also possible to chain stubs like this:
mockedList.get(0) returns "one" thenReturns "two" mockedList.get(0) returns "one" thenThrows new Exception("unexpected now")
- trait MockitoStubsLowerImplicits extends AnyRef
-
trait
MocksCreation extends TheMockitoMocker with ClassesOf
This trait provides methods to create mocks and spies.
-
trait
TheMockitoMocker extends AnyRef
delegate to Mockito static methods with appropriate type inference.
Value Members
- object ArgThat extends ArgThat
- object CalledMatchers extends CalledMatchers
- object CapturedArgument extends CapturedArgument
- object FunctionArguments extends FunctionArguments
- object MockitoFunctions extends MockitoFunctions
- object MockitoMatchers extends MockitoMatchers
- object MockitoStubs extends MockitoStubs
- object MocksCreation extends MocksCreation