This post originated from an RSS feed registered with Java Buzz
by Dan Haywood.
Original Post: JMock Actions API
Feed Title: Domain Driven Design using Naked Objects
Feed URL: http://danhaywood.com/feed/
Feed Description: Naked Objects is an open source Java framework making it easy to develop domain-driven applications. This blog provides hints and tips to help you get the most out of Naked Objects and its sister projects, extending and supplementing the ideas in Dan's pragprog book of the same name.
I use JMock as my preferred mocking library. Most of the time the expectations I write are pretty simple, indicating that a mock should return this value, or should throw this exception. For example:
[code lang="java"]
mockery.checking(new Expectations() {{
allowing(mockConfiguration).getString(
"nakedobjects.persistor.adapter-factory",
PojoAdapterFactory.class.getName());
...