scala - How to perform a custom check of the arguments being passed to mockito mocks -


i have problem writing tests scala project using specs2 , mockito. there way perform complex checks arguments passed method being tested mocked service method? example:

  session = ....   sessiondao.getbyuid(sessionuid).returns(some(session))    val result = service.refreshsessionfor(token)    result must beleft    got{     one(sessiondao).getbyuid(sessionuid)     one(sessiondao).update(any[session])   } 

the problem is, want check whether field "lastused" of session object updated or not. way check parameter fields of sessiondao.update method. cannot find how in mockito manual.

you can pass specs2 matcher mocked method:

got{   one(sessiondao).getbyuid(sessionuid)   one(sessiondao).update(belike[session] { case s: session => s.lastused must be_>(last) }) } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -