Scalatest 中 mustBe 的否定是什么
What is the negative of mustBe in Scalatest
我很乐意在 Scalatest
中使用 mustBe
。例如
A mustBe (Some(List(1)))
但是我该如何测试 A must not be Some(anything here, done care what it is)
之类的东西?
Negation 可以通过简单地将单词 not
添加到匹配器表达式来断言,例如,
class So1Spec extends FlatSpec with MustMatchers {
"BeingNegative" should "assert negation" in {
1 must not be 2
}
}
我很乐意在 Scalatest
中使用 mustBe
。例如
A mustBe (Some(List(1)))
但是我该如何测试 A must not be Some(anything here, done care what it is)
之类的东西?
Negation 可以通过简单地将单词 not
添加到匹配器表达式来断言,例如,
class So1Spec extends FlatSpec with MustMatchers {
"BeingNegative" should "assert negation" in {
1 must not be 2
}
}