org.specs2.mock.mockito

MocksCreation

trait MocksCreation extends TheMockitoMocker

This trait provides methods to create mocks and spies.

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

Type Members

  1. class NamedMock [T] extends AnyRef

    support class to create a mock object with a name

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

    Attributes
    final
    Definition Classes
    Any
  7. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. def eq (arg0: AnyRef): Boolean

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef → Any
  12. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  13. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  14. 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]]

  15. 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")

  16. 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
  17. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  18. def notify (): Unit

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

    Attributes
    final
    Definition Classes
    AnyRef
  20. 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.

  21. 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

  22. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  23. def toString (): String

    Definition Classes
    AnyRef → Any
  24. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from TheMockitoMocker

Inherited from AnyRef

Inherited from Any