Trait/Object

org.specs2.mock.mockito

MocksCreation

Related Docs: object MocksCreation | package mockito

Permalink

trait MocksCreation extends TheMockitoMocker with ClassesOf

This trait provides methods to create mocks and spies.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MocksCreation
  2. ClassesOf
  3. TheMockitoMocker
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

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

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. implicit def anyToMockProperty[T](t: ⇒ T): MockProperty[T]

    Permalink

    this implicit helps with defining optional values for mockito settings

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def classesOf[T1, T2, T3, T4, T5](implicit arg0: ClassTag[T1], arg1: ClassTag[T2], arg2: ClassTag[T3], arg3: ClassTag[T4], arg4: ClassTag[T5]): Seq[Class[_ >: _$1 with _$1 with _$1 with _$1 with _$1]] forSome {type _$1, type _$1, type _$1, type _$1, type _$1}

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

    Permalink
    Definition Classes
    ClassesOf
  8. def classesOf[T1, T2, T3](implicit arg0: ClassTag[T1], arg1: ClassTag[T2], arg2: ClassTag[T3]): Seq[Class[_ >: _$1 with _$1 with _$1]] forSome {type _$1, type _$1, type _$1}

    Permalink
    Definition Classes
    ClassesOf
  9. def classesOf[T1, T2](implicit arg0: ClassTag[T1], arg1: ClassTag[T2]): Seq[Class[_ >: _$1 with _$1]] forSome {type _$1, type _$1}

    Permalink
    Definition Classes
    ClassesOf
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. def ignoreStubs(mocks: AnyRef*): IgnoreStubs

    Permalink

    ignore stubbed methods when verifying that a mock has no more interactions

  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def mock[T](settings: MockSettings)(implicit arg0: ClassTag[T]): T

    Permalink

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

  19. def mock[T](implicit arg0: ClassTag[T]): T

    Permalink

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

  20. def mockAs[T](name: String)(implicit arg0: ClassTag[T]): T

    Permalink

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

  21. implicit def mocked[T](t: ⇒ T)(implicit arg0: ClassTag[T]): Mocked[T]

    Permalink

    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])
  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. def smartMock[T](implicit arg0: ClassTag[T]): T

    Permalink

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

    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.

  26. def spy[T](m: T): T

    Permalink

    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
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ClassesOf

Inherited from TheMockitoMocker

Inherited from AnyRef

Inherited from Any

Ungrouped