when(
fooDao.getBar(
any(Bazoo.class)
)
).thenReturn(myFoo);
Are you interested in learning Java from the basics! Refer to this video on Java provided by Intellipaat:
instead (to withdraw nulls):
when(
fooDao.getBar(
(Bazoo)notNull()
)
).thenReturn(myFoo);
Don't neglect to carry equals (several others are possible):
For Mockito 2.1.0 and later:
import static org.mockito.ArgumentMatchers.*;
For more traditional versions:
import static org.mockito.Matchers.*;