reactivemongo
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") () }
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.