According to this document to verify order of calls we need:
val m1 = mock[List[String]]
val m2 = mock[List[String]]
m1.get(0)
m1.get(0)
m2.get(0)
here was one(m1).get(0) then one(m1).get(1)
With my code
...
val db = mock[Database]
"The code" should {
"Should do something" in {
val id = "id"
db.readUserByid(anyString) returns None
val rv = api.login(id)
there was one(db).readUserByid(id) then one(db).createUser(anyString)
}
}
...
I get an error
value then is not a member of org.specs2.matcher.MatchResult[Option[models.domain.user.User]]
and a warning
then is now a reserved word; usage as an identifier is deprecated
I'm using Play framework 2.2.0, Specs2 bundled with this version of Play, Mockito 1.9.5
Could you please point out to a correct document what contains information about verifying order of calls?
Thank you very much :)
You need to use andThen
there was one(db).readUserByid(id) andThen one(db).createUser(anyString)