Search code examples
scalamatcherspecs2

Specs2 - "should not equal to" - how to check for non-equality?


There are lot of examples about how to check for equality in Specs2, but no examples on how to check for non-equality.

I tried (among other things) the following but it did not work :

"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"
  }
}

how can I make this work ?

How can I check for non-equality in Specs2 ?

Google did not help.


Solution

  • Either one of the followings:

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