Search in sources :

Example 1 with DataLayerConfig

use of com.adobe.cq.wcm.core.components.internal.DataLayerConfig in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class Utils method enableDataLayer.

/**
 * Sets the data layer context aware configuration of the AEM test context to enabled/disabled
 *
 * @param context The AEM test context
 * @param enabled {@code true} to enable the data layer, {@code false} to disable it
 */
public static void enableDataLayer(AemContext context, boolean enabled) {
    ConfigurationBuilder builder = Mockito.mock(ConfigurationBuilder.class);
    DataLayerConfig dataLayerConfig = Mockito.mock(DataLayerConfig.class);
    lenient().when(dataLayerConfig.enabled()).thenReturn(enabled);
    lenient().when(builder.as(DataLayerConfig.class)).thenReturn(dataLayerConfig);
    context.registerAdapter(Resource.class, ConfigurationBuilder.class, builder);
}
Also used : ConfigurationBuilder(org.apache.sling.caconfig.ConfigurationBuilder) DataLayerConfig(com.adobe.cq.wcm.core.components.internal.DataLayerConfig)

Aggregations

DataLayerConfig (com.adobe.cq.wcm.core.components.internal.DataLayerConfig)1 ConfigurationBuilder (org.apache.sling.caconfig.ConfigurationBuilder)1