0

I am using playframework 2.4.x, and this libraries

"org.scalatest" %% "scalatest" % "2.2.1" % "test"
"org.scalatestplus" %% "play" % "1.4.0-M3" % "test"

I want to check if therea are some strings in a List I build on the test, this is the code

val userTeams = validateAndGet((teamsUserResponse.json \ "teams").asOpt[List[TeamUser]]).map( x => x.teamKey )
userTeams must contain ("team1", "team2")

But I am getting this error

List("team1", "team2") did not contain element (team1,team2)
agusgambina
  • 6,229
  • 14
  • 54
  • 94

1 Answers1

3

If you write ("team1", "team2") then you're actualy creating a tuple of two strings which is from perspective of the ScalaTest matcher a single element.

Based on documentation you have to use allOf:

userTeams must contain allOf ("team1", "team2")
Rado Buransky
  • 3,252
  • 18
  • 25