java - How to verify that a method gets called with any argument? -
i verify()
mockito whether or not method gets called. since not know argument in such way verifies any()
argument. possible? @ moment getting "error, wanted x , found y". not care parameter passed, know if method gets called @ all. in advance.
as of have tried:
when(userbean.getprofile().getlanguage().getvalue()).thenreturn("fr"); verify((userbean), atleastonce()).getprofile().getlanguage().getvalue();
userbean has been mocked return_deep_stubs
. getting null pointer exception though. may due fact userbean ejb?
as in mockito documentation returns_deep_stubs:
verification works last mock in chain. can use verification modes.
for example:
/* bad */ verify(userbean, atleastonce()).getprofile().getlanguage().getvalue(); /* */ verify(userbean.getprofile().getlanguage(), atleastonce()).getvalue();
(added separate answer point documentation link.)
Comments
Post a Comment