Class

reactivemongo.api

TestCursor

Related Doc: package api

Permalink

class TestCursor[T] extends Cursor[T]

EXPERIMENTAL: Base class to implement test-only/mocked Cursor.

All functions failed future by default, make sure to override the required functions with appropriate results to execute the tests.

import scala.concurrent.{ ExecutionContext, Future }

import reactivemongo.api.{ Cursor, TestCursor }

final class MyTestCursor[T](h: T) extends TestCursor[T] {
  override def head(implicit ctx: ExecutionContext): Future[T] =
    Future.successful(h)
}

val cursor: Cursor[String] = new MyTestCursor("foo")

def foo(implicit ec: ExecutionContext) {
  cursor.headOption // Future.failed by default

  cursor.head // Future.successful("foo")

  ()
}
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TestCursor
  2. Cursor
  3. CursorCompatAPI
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TestCursor()

    Permalink

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to any2stringadd[TestCursor[T]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (TestCursor[T], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to ArrowAssoc[TestCursor[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def collect[M[_]](maxDocs: Int, err: ErrorHandler[M[T]])(implicit cbf: CanBuildFrom[M[_], T, M[T]], ec: ExecutionContext): Future[M[T]]

    Permalink
    Definition Classes
    TestCursor → CursorCompatAPI
  9. def ensuring(cond: (TestCursor[T]) ⇒ Boolean, msg: ⇒ Any): TestCursor[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to Ensuring[TestCursor[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (TestCursor[T]) ⇒ Boolean): TestCursor[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to Ensuring[TestCursor[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): TestCursor[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to Ensuring[TestCursor[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): TestCursor[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to Ensuring[TestCursor[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def fold[A](z: ⇒ A, maxDocs: Int)(suc: (A, T) ⇒ A)(implicit ec: ExecutionContext): Future[A]

    Permalink
    Definition Classes
    Cursor
  17. def foldBulks[A](z: ⇒ A, maxDocs: Int)(suc: (A, Iterator[T]) ⇒ State[A], err: ErrorHandler[A])(implicit ctx: ExecutionContext): Future[A]

    Permalink
    Definition Classes
    TestCursor → Cursor
  18. def foldBulksM[A](z: ⇒ A, maxDocs: Int)(suc: (A, Iterator[T]) ⇒ Future[State[A]], err: ErrorHandler[A])(implicit ctx: ExecutionContext): Future[A]

    Permalink
    Definition Classes
    TestCursor → Cursor
  19. def foldWhile[A](z: ⇒ A, maxDocs: Int)(suc: (A, T) ⇒ State[A], err: ErrorHandler[A])(implicit ctx: ExecutionContext): Future[A]

    Permalink
    Definition Classes
    TestCursor → Cursor
  20. def foldWhileM[A](z: ⇒ A, maxDocs: Int)(suc: (A, T) ⇒ Future[State[A]], err: ErrorHandler[A])(implicit ctx: ExecutionContext): Future[A]

    Permalink
    Definition Classes
    TestCursor → Cursor
  21. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to StringFormat[TestCursor[T]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  24. def head(implicit ctx: ExecutionContext): Future[T]

    Permalink
    Definition Classes
    TestCursor → Cursor
  25. def headOption(implicit ctx: ExecutionContext): Future[Option[T]]

    Permalink
    Definition Classes
    TestCursor → Cursor
  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  30. def peek[M[_]](maxDocs: Int)(implicit cbf: CanBuildFrom[M[_], T, M[T]], ec: ExecutionContext): Future[Result[M[T]]]

    Permalink
    Definition Classes
    TestCursor → CursorCompatAPI
  31. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def [B](y: B): (TestCursor[T], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestCursor[T] to ArrowAssoc[TestCursor[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Cursor[T]

Inherited from CursorCompatAPI[T]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from TestCursor[T] to any2stringadd[TestCursor[T]]

Inherited by implicit conversion StringFormat from TestCursor[T] to StringFormat[TestCursor[T]]

Inherited by implicit conversion Ensuring from TestCursor[T] to Ensuring[TestCursor[T]]

Inherited by implicit conversion ArrowAssoc from TestCursor[T] to ArrowAssoc[TestCursor[T]]

Ungrouped