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
Post a Comment