我正在尝试编写一个简单的测试
"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)
)}
那么,任何想法第一个出了什么问题?