Yes, you need a expectation for every call on a mock executed during a test.

I would recommend to use EasyMock instead of JMock.
It's very easy to use, e.g. creating a mock:

GameDAO gameDAO = EasyMock.createStricktMock(GameDAO.class);

If you call a method e.g. public Game getGame(Long id) on gameDAO, simply
add something like

Game game = new Game();
EasyMock.expect(gameDAO.getGame(1L)).andReturn(game);

to replay the Mock, use EasyMock.replay(gameDAO);

In order to verify a mock, call EasyMock.verify(gameDAO);

Bye,

Peter

2007/12/17, Struts2 Fan <[EMAIL PROTECTED]>:
>
>
> I have no expectation for the moveDao, must I define an expectation for
> each
> Dao I have used in methods?
>
> --
> View this message in context:
> http://www.nabble.com/-Appfuse2.0--Best-Practise-Design-Pattern-for-Multiple-Dao-Access-from-managers-tp14116309s2369p14370264.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to