reactivemongo.api

Members list

Concise view

Type members

Classlikes

class TestCursor[T] extends Cursor[T]

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

'''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): Unit = {
 cursor.headOption // Future.failed by default

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

 ()
}

Attributes

Graph
Supertypes
trait Cursor[T]
class Object
trait Matchable
class Any