Specs2 - “不应该等于” - 如何检查不相等?

jhe*_*dus 2 scala matcher specs2

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

我尝试了(除其他外)以下方法,但它不起作用:

"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"
  }
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

如何检查 Specs2 中的不相等性?

谷歌没有提供帮助。

PH8*_*H88 8

以下任一情况:

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