规格2 - "不应等于" - 如何检查不平等?

时间:2017-04-29 13:52:54

标签: scala matcher specs2

有很多关于如何在Specs2中检查相等性的examples,但没有关于如何检查不相等的例子。

我尝试了(除其他事项外)以下但是没有用:

"type safe get should work" in {
  Get("/SimpleLine") ~> getRoute[SimpleLine] ~> check {
    responseAs[String] shouldEqual "my name is SimpleLine"
    responseAs[String] shouldNot equal to "my name is SimpleLine2"
  }
}

我该如何做到这一点?

如何检查Specs2中的不相等?

谷歌没有帮助。

1 个答案:

答案 0 :(得分:4)

以下任何一项:

  • "a" should not equalTo "b"
  • "a" shouldNotEqual "b"
  • "a" should_!= "b"
  • "a" must not equalTo "b"
  • "a" mustNotEqual "b"
  • "a" must_!= "b"