Packages

c

reactivemongo.api

TestCursor

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()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    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)
    Implicit
    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
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  8. def collect[M[_]](maxDocs: Int, err: ErrorHandler[M[T]])(implicit cbf: CanBuildFrom[M[_], T, M[T]], ec: ExecutionContext): Future[M[T]]
    Definition Classes
    TestCursor → CursorCompatAPI
  9. def ensuring(cond: (TestCursor[T]) ⇒ Boolean, msg: ⇒ Any): TestCursor[T]
    Implicit
    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]
    Implicit
    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]
    Implicit
    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]
    Implicit
    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
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[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]
    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]
    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]
    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]
    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]
    Definition Classes
    TestCursor → Cursor
  21. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. def head(implicit ctx: ExecutionContext): Future[T]
    Definition Classes
    TestCursor → Cursor
  24. def headOption(implicit ctx: ExecutionContext): Future[Option[T]]
    Definition Classes
    TestCursor → Cursor
  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. def peek[M[_]](maxDocs: Int)(implicit cbf: CanBuildFrom[M[_], T, M[T]], ec: ExecutionContext): Future[Result[M[T]]]
    Definition Classes
    TestCursor → CursorCompatAPI
  30. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  35. def [B](y: B): (TestCursor[T], B)
    Implicit
    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

Deprecated Value Members

  1. def formatted(fmtstr: String): String
    Implicit
    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
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

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