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);
}
Aggregations