jeudi 8 octobre 2015

how to mock case class?

I have following case class:

case class User(username:String, createdDate:DateTime)

and a class to test:

class UserDAO{
def registerUser(user:User)
}

I want to verify that registerUser called with an input user that has username="myusername". Based on this docs http://ift.tt/1LCjFAG I came up with a code like this:

verify(userDAO).registerUser(User(eq("myusername"),any[DateTime]))

however it is not right and I had error while compiling.

Please advice.

Aucun commentaire:

Enregistrer un commentaire