About AEM Mocks

Mock implementation of selected AEM APIs.

Maven Central

Documentation

Implemented mock features

The mock implementation supports:

  • Access to mocked OSGi, mocked JCR and mocked Sling environment provided by the Apache Sling project
  • Resource access using different resource resolver types (see Resource Resolver Types)
  • Implementation of AEM WCM API objects PageManager, Page, Template, ComponentManager, Component, TagManager, Tag, Designer, ComponentContext, EditContext, EditConfig, Style, ContentPolicy, ContentPolicyMapping, ContentPolicyManager, LanguageManager
  • Implementation of AEM DAM API objects Asset, Rendition, ContentFragment, AssetStore, AssetHandler.
  • Implementation of AEM Granite API objects ResourceCollectionManager, ResourceCollection
  • JUnit rule AemContext for easy access to all context objects and registering adapter factories and OSGi services
  • Import and create test content for unit tests (see Test content loading and creation)
  • Registers OSGi services and adapter factories supported by the mock implementations
  • Full support for Sling Models
  • Setting run modes
  • Layer adapter factory
  • Context Plugins

Version Support Matrix

AEM Mock version AEM version supported JUnit version supported Java version required
AEM Mock 5.5.x or higher AEM 6.5.17+, AEMaaCS JUnit 4, JUnit 5 Java 11
AEM Mock 5.0.x - 5.4.x AEM 6.5.7+, AEMaaCS JUnit 4, JUnit 5 Java 8/Java 11 since 5.2
AEM Mock 4.x AEM 6.4+, AEMaaCS JUnit 4, JUnit 5 Java 8
AEM Mock 3.x AEM 6.3+ JUnit 4, JUnit 5 Java 8
AEM Mock 2.x AEM 6.2+ JUnit 4, JUnit 5 Java 7/Java 8 since 2.2.2
AEM Mock 1.x AEM 6.0+ JUnit 4 Java 7

Further Resources

GitHub Repository

Sources: https://github.com/wcm-io/io.wcm.testing.aem-mock

Back to top

Version: 5.5.1-SNAPSHOT. Last Published: 2024-03-21.