You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Justin Edelson <ju...@gmail.com> on 2010/05/04 22:18:06 UTC
warning - jmock 2.5.1 removes support for multiple mocks of the same
type
I'm going through the Sling codebase and getting everything ready to
release parent 9 as well as getting rid of the remaining Maven 3
warnings. While doing this, I came across a weird bit of behavior that I
wanted to point out in case it bites anyone else. In a few cases, we do
this with JMock:
Resource r = context.mock(Resource.class);
Resource r2 = context.mock(Resource.class);
In JMock 2.2.0 (used by parent 8), this worked fine. But in 2.5.1, this
fails because JMock names the mock using the class name. The solution is
to do this:
Resource r = context.mock(Resource.class, "resource");
Resource r2 = context.mock(Resource.class, "resource2");
I don't know if this is a bug in 2.5.1 or a bug in 2.2.0
Assuming there aren't too many of these and they're backwards compatible
(which they should be), I'll be committing a few of these later.
So far, found in:
Sling API
Post Servlet
Events
Justin