org.specs2.mock

Mockito

trait Mockito extends MocksCreation with CalledMatchers with MockitoStubs with CapturedArgument with MockitoMatchers with Expectations

This trait can be used to access Mockito functionalities.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Mockito
  2. MockitoMatchers
  3. CapturedArgument
  4. MockitoStubs
  5. CalledMatchers
  6. Expectations
  7. NumberOfTimes
  8. MocksCreation
  9. ClassesOf
  10. TheMockitoMocker
  11. AnyRef
  12. Any
Visibility
  1. Public
  2. All

Type Members

  1. class AStubber [T] extends AnyRef

    provide stub chain methods.

  2. class AnOngoingStubbing [T] extends AnyRef

    provide stub chain methods.

  3. class Calls extends AnyRef

    class supporting 'was' and 'were' methods to forward mockito calls to the CallsMatcher matcher

  4. class CanBeEqual [T] extends AnyRef

  5. class Descriptible [T] extends AnyRef

  6. class MockAnswer [T] extends Answer[T]

    This class is an implementation of the Answer interface allowing to pass functions as an answer.

  7. case class MockProperty [T] (p: Property[T]) extends Product with Serializable

  8. case class RangeInt (n: Int) extends Product with Serializable

  9. class RangeIntToTimes extends AnyRef

    class providing a apply method to be able to declare a number of calls: 3.

  10. class Stubbed [T] extends AnyRef

    This class provide stub methods like returns, throws and answers.

  11. class ToInOrderMode [T] extends AnyRef

    class defining a then method to declare that calls must be made in a specific order.

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. implicit def aStubber (stub: ⇒ Stubber): AStubber[Nothing]

    returns

    an object allowing the chaining of returned values on doNothing calls.

    Attributes
    implicit
    Definition Classes
    MockitoStubs
  7. def anArgThat [T, U <: T] (m: Matcher[U]): T

    allows to use a hamcrest matchers to match parameters.

    allows to use a hamcrest matchers to match parameters.

    Definition Classes
    MockitoStubs
  8. implicit def anOngoingStubbing [T] (stub: ⇒ OngoingStubbing[T]): AnOngoingStubbing[T]

    returns

    an object allowing the chaining of stub values.

    Attributes
    implicit
    Definition Classes
    MockitoStubs
  9. def any [T] (implicit arg0: Manifest[T]): T

    Definition Classes
    MockitoMatchers
  10. def anyByte : Byte

    Definition Classes
    MockitoMatchers
  11. def anyChar : Char

    Definition Classes
    MockitoMatchers
  12. def anyDouble : Double

    Definition Classes
    MockitoMatchers
  13. def anyFloat : Float

    Definition Classes
    MockitoMatchers
  14. def anyInt : Int

    Definition Classes
    MockitoMatchers
  15. def anyLong : Long

    Definition Classes
    MockitoMatchers
  16. def anyShort : Short

    Definition Classes
    MockitoMatchers
  17. def anyString : String

    Definition Classes
    MockitoMatchers
  18. implicit def anyToMockProperty [T] (t: ⇒ T): MockProperty[T]

    this implicit helps with defining optional values for mockito settings

    this implicit helps with defining optional values for mockito settings

    Attributes
    implicit
    Definition Classes
    MocksCreation
  19. implicit def argThat [T, U <: T] (m: Matcher[U]): T

    allows to use a specs matcher to match parameters by encapsulating it as a Hamcrest matcher.

    allows to use a specs matcher to match parameters by encapsulating it as a Hamcrest matcher.

    Attributes
    implicit
    Definition Classes
    MockitoStubs
  20. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  21. def atLeast [T <: AnyRef] (i: Int)(mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at least n calls made to the mock

    at least n calls made to the mock

    Definition Classes
    CalledMatchers
  22. def atLeastOne [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at least 1 call made to the mock

    at least 1 call made to the mock

    Definition Classes
    CalledMatchers
  23. def atLeastThree [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at least 3 calls made to the mock

    at least 3 calls made to the mock

    Definition Classes
    CalledMatchers
  24. def atLeastTwo [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at least 2 calls made to the mock

    at least 2 calls made to the mock

    Definition Classes
    CalledMatchers
  25. def atMost [T <: AnyRef] (i: Int)(mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at most n calls made to the mock

    at most n calls made to the mock

    Definition Classes
    CalledMatchers
  26. def atMostOne [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at most 1 call made to the mock

    at most 1 call made to the mock

    Definition Classes
    CalledMatchers
  27. def atMostThree [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at most 3 calls made to the mock

    at most 3 calls made to the mock

    Definition Classes
    CalledMatchers
  28. def atMostTwo [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    at most 2 calls made to the mock

    at most 2 calls made to the mock

    Definition Classes
    CalledMatchers
  29. implicit def canBeEqual [T] (t: ⇒ T): CanBeEqual[T]

    A value can be tested against another with the === operator.

    A value can be tested against another with the === operator. It is equivalent to writting a must_== b

    Attributes
    implicit
    Definition Classes
    Expectations
  30. def capture [T] (implicit arg0: ClassManifest[T]): ArgumentCapture[T]

    capture an argument of type T

    capture an argument of type T

    Definition Classes
    CapturedArgument
  31. implicit def captured [T] (c: ArgumentCapture[T]): T

    this conversion allows to capture the parameter is a mocked call

    this conversion allows to capture the parameter is a mocked call

    Attributes
    implicit
    Definition Classes
    CapturedArgument
  32. def checkFailure [T] (m: MatchResult[T]): MatchResult[T]

    this method can be overriden to throw exceptions when checking the match result

    this method can be overriden to throw exceptions when checking the match result

    Attributes
    protected
    Definition Classes
    Expectations
  33. def checkResultFailure (r: Result): Result

    this method can be overriden to throw exceptions when checking the result

    this method can be overriden to throw exceptions when checking the result

    Attributes
    protected
    Definition Classes
    Expectations
  34. def classesOf [T1, T2, T3, T4, T5] (implicit arg0: ClassManifest[T1], arg1: ClassManifest[T2], arg2: ClassManifest[T3], arg3: ClassManifest[T4], arg4: ClassManifest[T5]): Seq[java.lang.Class[_ >: _$1 with _$1 with _$1 with _$1 with _$1]] forSome { type _$1; type _$1; type _$1; type _$1; type _$1 }

    Definition Classes
    ClassesOf
  35. def classesOf [T1, T2, T3, T4] (implicit arg0: ClassManifest[T1], arg1: ClassManifest[T2], arg2: ClassManifest[T3], arg3: ClassManifest[T4]): Seq[java.lang.Class[_ >: _$1 with _$1 with _$1 with _$1]] forSome { type _$1; type _$1; type _$1; type _$1 }

    Definition Classes
    ClassesOf
  36. def classesOf [T1, T2, T3] (implicit arg0: ClassManifest[T1], arg1: ClassManifest[T2], arg2: ClassManifest[T3]): Seq[java.lang.Class[_ >: _$1 with _$1 with _$1]] forSome { type _$1; type _$1; type _$1 }

    Definition Classes
    ClassesOf
  37. def classesOf [T1, T2] (implicit arg0: ClassManifest[T1], arg1: ClassManifest[T2]): Seq[java.lang.Class[_ >: _$1 with _$1]] forSome { type _$1; type _$1 }

    Definition Classes
    ClassesOf
  38. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  39. def createExpectable [T] (t: ⇒ T, alias: Option[(String) ⇒ String]): Expectable[T]

    returns

    an Expectable with a description function

    Definition Classes
    Expectations
  40. def createExpectable [T] (t: ⇒ T, alias: (String) ⇒ String): Expectable[T]

    returns

    an Expectable with a description function

    Definition Classes
    Expectations
  41. def createExpectable [T] (t: ⇒ T, alias: String): Expectable[T]

    returns

    an Expectable with a description

    Definition Classes
    Expectations
  42. def createExpectable [T] (t: ⇒ T): Expectable[T]

    returns

    an Expectable

    Definition Classes
    Expectations
  43. implicit def describe [T] (t: ⇒ T): Descriptible[T]

    describe a value with the aka method

    describe a value with the aka method

    Attributes
    implicit
    Definition Classes
    Expectations
  44. def doAnswer [T] (f: (Any) ⇒ T): Stubber

    delegate to MockitoMocker doAnswer with a MockAnswer object using the function f.

    delegate to MockitoMocker doAnswer with a MockAnswer object using the function f.

    Definition Classes
    MockitoStubs
  45. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  46. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  47. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  48. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  49. def got [T] (t: ⇒ T): MatchResult[T]

    alias for 'there was'

    alias for 'there was'

    Definition Classes
    CalledMatchers
  50. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  51. def inOrder (mocks: AnyRef*): Option[InOrder]

    Definition Classes
    CalledMatchers
  52. implicit def integerToRange (n: Int): RangeInt

    This implicit definition allows to declare a number of times 3.times

    This implicit definition allows to declare a number of times 3.times

    Attributes
    implicit
    Definition Classes
    NumberOfTimes
  53. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  54. def mock [T] (settings: MockSettings)(implicit arg0: ClassManifest[T]): T

    create a mock object with some specific settings: val m = mock[java.

    create a mock object with some specific settings: val m = mock[java.util.List[String]](settings)

    Definition Classes
    MocksCreation
  55. def mock [T] (implicit arg0: ClassManifest[T]): T

    create a mock object: val m = mock[java.

    create a mock object: val m = mock[java.util.List[String]]

    Definition Classes
    MocksCreation
  56. def mockAs [T] (name: String)(implicit arg0: ClassManifest[T]): T

    create a mock object with a name: val m = mockAs[java.

    create a mock object with a name: val m = mockAs[java.util.List[String]]("name")

    Definition Classes
    MocksCreation
  57. implicit def mocked [T] (t: ⇒ T)(implicit arg0: ClassManifest[T]): Mocked[T]

    implicit allowing to define the mock settings with a nice syntax:

    implicit allowing to define the mock settings with a nice syntax:

    • named mock: val m = mock[java.util.List[String]].as("name")
    • smart mock: val m = mock[java.util.List[String]].smart
    • other settings: val m = mock[java.util.List[String]]. settings(name = "list", defaultReturn = 10, extraInterfaces = classesOf[Cloneable, Serializable])
    Attributes
    implicit
    Definition Classes
    MocksCreation
  58. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  59. def no [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    no call made to the mock

    no call made to the mock

    Definition Classes
    CalledMatchers
  60. def noMoreCallsTo [T <: AnyRef] (mock: T): Unit

    no more calls made to the mock

    no more calls made to the mock

    Definition Classes
    CalledMatchers
  61. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  62. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  63. def one [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    one call only made to the mock

    one call only made to the mock

    Definition Classes
    CalledMatchers
  64. implicit def rangeIntToTimes (r: RangeInt): RangeIntToTimes

    implicit definition to be able to declare a number of calls 3.

    implicit definition to be able to declare a number of calls 3.times(m).clear()

    Attributes
    implicit
    Definition Classes
    CalledMatchers
  65. def smartMock [T] (implicit arg0: ClassManifest[T]): T

    create a mock object with smart return values: val m = smartMock[java.

    create a mock object with smart return values: val m = smartMock[java.util.List[String]]

    This is the equivalent of Mockito.mock(List.class, SMART_NULLVALUES) but testing shows that it is not working well with Scala.

    Definition Classes
    MocksCreation
  66. def spy [T] (m: T): T

    create a spy on an object.

    create a spy on an object.

    A spy is a real object but can still have some of its methods stubbed. However the syntax for stubbing a spy is a bit different than with a mock: val s = spy(new LinkedList[String]) doReturn("one").when(s).get(0) // instead of s.get(0) returns "one" which would throw an exception

    Definition Classes
    MocksCreation
  67. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  68. implicit def theStubbed [T] (c: ⇒ T): Stubbed[T]

    returns

    an object supporting the stub methods.

    Attributes
    implicit
    Definition Classes
    MockitoStubs
  69. def there : Calls

    create an object supporting 'was' and 'were' methods

    create an object supporting 'was' and 'were' methods

    Definition Classes
    CalledMatchers
  70. def three [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    three calls only made to the mock

    three calls only made to the mock

    Definition Classes
    CalledMatchers
  71. implicit def toInOrderMode [T] (calls: ⇒ T)(implicit arg0: (T) ⇒ Result): ToInOrderMode[T]

    implicit def supporting calls in order

    implicit def supporting calls in order

    Attributes
    implicit
    Definition Classes
    CalledMatchers
  72. def toString (): String

    Definition Classes
    AnyRef → Any
  73. def two [T <: AnyRef] (mock: T)(implicit anOrder: Option[InOrder] = inOrder()): T

    two calls only made to the mock

    two calls only made to the mock

    Definition Classes
    CalledMatchers
  74. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  75. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  76. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from MockitoMatchers

Inherited from CapturedArgument

Inherited from MockitoStubs

Inherited from CalledMatchers

Inherited from Expectations

Inherited from NumberOfTimes

Inherited from MocksCreation

Inherited from ClassesOf

Inherited from TheMockitoMocker

Inherited from AnyRef

Inherited from Any