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

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -