将非空试验结果改为;“空测试套件”;带有ReactiveMongo插件的ScalaTest中的输出

将非空试验结果改为;“空测试套件”;带有ReactiveMongo插件的ScalaTest中的输出,scala,playframework-2.0,scalatest,reactivemongo,Scala,Playframework 2.0,Scalatest,Reactivemongo,我想写一个简单的测试 "CurrencyDao" should "read Currency from the DB" in { def collection: JSONCollection = ReactiveMongoPlugin.db.collection[JSONCollection]("currencies") collection.find(Json.obj("_id" -> "EUR")).cursor[JsObject].collect[List](

我想写一个简单的测试

  "CurrencyDao" should "read Currency from the DB" in {
     def collection: JSONCollection = ReactiveMongoPlugin.db.collection[JSONCollection]("currencies")
     collection.find(Json.obj("_id" -> "EUR")).cursor[JsObject].collect[List]().map ( currencies =>
        assertResult(1)(currencies.size)
     )}
运行它会导致“空测试套件”输出,而且不用说,断言不会被检查

但是,使用insert命令的类似测试会按预期执行

"CurrencyDao" should "save Currency to the DB" in {
   val json = Json.obj("_id" -> "PLN")

  collection.insert(json).map(lastError =>
    intercept[NoSuchElementException](lastError.err.get)
  )}

你知道第一个有什么问题吗

我认为你需要等待你未来的结果。ScalaTest为此提供了一些帮助。我的另一种为测试准备数据的方法出现了一些问题,但你的答案也很相关,等待未来解决了我确定准备方法后剩下的问题。