List of AEM Mock Context Plugins

List of Context Plugins

This page lists all AEM Mocks Context Plugins that are available. These plugins hook into the AEM Mocks Lifecyle and register all OSGi services that are required to test the use cases.

Context PluginUse CasePlugin Class
AEM WCM Core Components Plugin for AEM MocksTest code extending AEM WCM Core Components
Apache Sling Context-Aware Configuration Mock PluginTest code using Sling Context-Aware Configuration Context-Aware Configuration Mock HelperTest code using Sling Context-Aware Configuration together with Context-Aware Configuration Extensions
io.wcm.testing.mock.wcmio.caconfig.ContextPlugins.WCMIO_CACONFIG WCM Mock HelperTest code using WCM Commons
io.wcm.testing.mock.wcmio.wcm.ContextPlugins.WCMIO_WCM Sling Extensions Mock HelperTest code using AEM Sling Models Extensions Handler Mock HelperTest code using Handler

Usage Example

Example of a "AppAemContext" class which can be used in all your unit test classes to create a preconfigured AemContext object with all you need in your project.

import static io.wcm.testing.mock.wcmio.caconfig.ContextPlugins.WCMIO_CACONFIG;
import static;

import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextBuilder;

public class AppAemContext {
  public static AemContext newAemContext() {
    return new AemContextBuilder()
        // register plugins
        // shared context setup code for all tests
        .<AemContext>afterSetUp(context -> {
          // add more setup code here