简体   繁体   中英

has ScalaTest an or matcher, testing with PlaySpec Playframework and Scala

I am writing some test in playspec and I want like to write a matcher like this

planPromise.trialPeriodDays mustBe (equal (planRequest.trialPeriodDays) or be (None))

What the matcher is trying to do is to identify if the value is an int (previously defined) or none.

Obviosly is not working.

Is there a way to write this?

Thank you

Checkout ScalaTest guide here: http://www.scalatest.org/user_guide/using_matchers and search for "Logical expressions with and and or"

here is an example copied from there

option should (equal (Some(List(1, 2, 3))) or be (None))

I guess your problem here is using mustBe instead of must

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM