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

Reply via email to