Home » Documentation » Development

Resource Resolver Mock

Mock for the resource resolver / factory for easier testing. It uses an in-memory map for storing the resource data, and supports reading, writing and a certain level of transaction and eventing support.

Maven Dependency


See latest version on the downloads page.

Implemented mock features

The mock implementation supports:

The following features are not supported:


To create a mocked resource resolver:

MockResourceResolverFactory factory = new MockResourceResolverFactory();
ResourceResolver resolver = factory.getResourceResolver(null);

With the resolver you can use all Sling Resource features including reading and writing data using the Sling API.

You cannot do any operations that require the JCR API because no JCR is underlying and adapting to JCR objects will just return null.

Rev. 1652263 by sseifert on Thu, 15 Jan 2015 20:27:35 +0000
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.