scala - Scalatest Matcher - Check single value exists in a set of values -
i generating value, , know possible values be. want write this
val myint = somefunction() myint shouldbe oneof (1, 2, 3)
however doesn't seem work me of scalatest 3 m15. workaround
list(myvalue) should contain atmostoneof (1, 2, 3)
which lot more confusing read , understand.
is there way want here? seems common scenario.
oneof
can used compare contents of collections. can use some
simple one-element collection:
some(myint) should contain oneof (1, 2, 3)
alternatively:
myint should (equal(1) or equal(2) or equal(3))
Comments
Post a Comment