Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scala test - how to stub curry method

I have this method

  def addFriend(friendId:String)(userId:String)

I am trying to stub it like this :

 (repositoryMock.addFriend(_:String)(_:String)) when ("bar","foo") returns true

but of course it will not work . and couldn't do something like (doesn't compile)

 (repositoryMock.addFriend(_:String)(_:String)) when ("bar")("foo") returns true

any ideas ?

like image 981
igx Avatar asked Oct 19 '22 15:10

igx


1 Answers

The solution is what you first tried - put all the curried arguments in a single list:

(repositoryMock.addFriend(_:String)(_:String)) when ("bar", "foo") returns true
like image 114
Ben Avatar answered Oct 21 '22 07:10

Ben