Package

org.specs2.mock

mockito

Permalink

package mockito

Visibility
  1. Public
  2. All

Type Members

  1. trait ArgThat extends AnyRef

    Permalink
  2. class ArgumentCapture[T] extends AnyRef

    Permalink

    This class encapsulates an ArgumentCaptor

  3. trait CalledMatchers extends NumberOfTimes with FunctionArguments with TheMockitoMocker with Expectations

    Permalink

    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) }
  4. trait CapturedArgument extends AnyRef

    Permalink

    Syntactic sugar on top of the ArgumentCaptor API to avoid using classOf and an explicit call to capture()

  5. trait FunctionArguments extends FunctionArgumentsLowImplicits

    Permalink
  6. trait FunctionArgumentsLowImplicits extends ArgThat with Expectations

    Permalink

    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

  7. case class IgnoreStubs(mocks: Seq[AnyRef]) extends Product with Serializable

    Permalink

    This class encapsulate mocks which must have their stubbed methods ignored in verification methods

  8. trait MockitoFunctions extends TheMockitoMocker

    Permalink

    shortcuts to standard Mockito functions

  9. trait MockitoMatchers extends ArgThat

    Permalink

    Mockito Matchers for the most common types

  10. trait MockitoStubs extends MocksCreation with MockitoStubsLowerImplicits

    Permalink

    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")
  11. trait MockitoStubsLowerImplicits extends AnyRef

    Permalink
  12. trait MocksCreation extends TheMockitoMocker with ClassesOf

    Permalink

    This trait provides methods to create mocks and spies.

  13. trait TheMockitoMocker extends AnyRef

    Permalink

    delegate to Mockito static methods with appropriate type inference.

Ungrouped