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. TheMockitoMocker
  10. AnyRef
  11. 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. class NamedMock [T] extends AnyRef

    support class to create a mock object with a name

  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 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
  19. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. def capture [T] (implicit arg0: ClassManifest[T]): ArgumentCapture[T]

    capture an argument of type T

    capture an argument of type T

    Definition Classes
    CapturedArgument
  30. 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
  31. def checkFailure [T] (m: MatchResult[T]): MatchResult[T]

    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
  32. def clone (): AnyRef

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

    returns

    an Expectable with a description function

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

    returns

    an Expectable with a description function

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

    returns

    an Expectable with a description

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

    returns

    an Expectable

    Definition Classes
    Expectations
  37. 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
  38. 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
  39. def eq (arg0: AnyRef): Boolean

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

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

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

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

    alias for 'there was'

    alias for 'there was'

    Definition Classes
    CalledMatchers
  44. def hashCode (): Int

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

    Definition Classes
    CalledMatchers
  46. 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
  47. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  48. 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
  49. 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
  50. implicit def mockToAs [T] (t: ⇒ T)(implicit arg0: ClassManifest[T]): NamedMock[T]

    implicit allowing the following syntax for a named mock: val m = mock[java.

    implicit allowing the following syntax for a named mock: val m = mock[java.util.List[String]],as("name")

    Attributes
    implicit
    Definition Classes
    MocksCreation
  51. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  52. 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
  53. def noMoreCallsTo [T <: AnyRef] (mock: T): Unit

    no more calls made to the mock

    no more calls made to the mock

    Definition Classes
    CalledMatchers
  54. def notify (): Unit

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

    Attributes
    final
    Definition Classes
    AnyRef
  56. 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
  57. 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
  58. 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
  59. 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
  60. def synchronized [T0] (arg0: ⇒ T0): T0

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

    returns

    an object supporting the stub methods.

    Attributes
    implicit
    Definition Classes
    MockitoStubs
  62. def there : Calls

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

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

    Definition Classes
    CalledMatchers
  63. 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
  64. 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
  65. def toString (): String

    Definition Classes
    AnyRef → Any
  66. 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
  67. def wait (): Unit

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  69. 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 TheMockitoMocker

Inherited from AnyRef

Inherited from Any