Chris,

I would suggest doing the following:

In the @Given method, create the service, DAO, injection, expects and replay
In the @Then method, call the method
In the @When method, verify

You could then have a @AfterScenario that resets the mocks

Let me know if that doesn't make sense - or I may have EasyMock and JMock 
confused.

Brian

----- Original message -----
From: [email protected]
To: [email protected]
Date: Fri, 27 Aug 2010 14:35:13 -0000 (UTC)
Subject: [jbehave-user] JBehave & JMock

Hi folks.

When mapping a scenario to steps and one of the "When" steps implies that
one object invokes another I can not seem to find a way to have this map
to a method that does anything because the JMock expectations need to be
set up *before* the "Then" where the thing is actually done so things
already are starting to fall apart.

Given a service object and a DAO object
When the service object is invoked
Then expect the service object to invoke the DAO object

Logically you would think.

1. Create both collaborating objects and inject dependency.
2. Call service method
3. Create expectation

But it does not quite seem to work like that.

Am I thinking in the wrong direction here? Is there a better way?

Thanks

Chris

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---
Brian Repko
LearnThinkCode, Inc.
email: [email protected]
phone: +1 612 229 6779


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to