Expand my Community achievements bar.

anyone successfully used com.adobe.cq.wcm.core.components.testing.mock.ContextPlugins.CORE_COMPONENTS;

Avatar

Level 7

Has anyone successfully used 

import static com.adobe.cq.wcm.core.components.testing.mock.ContextPlugins.CORE_COMPONENTS;

 

I have copied all dependencies from https://github.com/wcm-io/io.wcm.maven.aem-dependencies/blob/develop/6.5.13/pom.xml

Above did not work.

 

I tried having below dependency in pom, core/pom files but somehow could not resolve this dependency at my client machine.

<dependency>
                <groupId>io.wcm.maven</groupId>
                <artifactId>io.wcm.maven.aem-dependencies</artifactId>
                <version>6.5.13.0000</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

 

Still could not get above import working in my junit.

 

Thanks,

Sri

 

3 Replies

Avatar

Employee Advisor

Hi,

 

To use the import statement import static com.adobe.cq.wcm.core.components.testing.mock.ContextPlugins.CORE_COMPONENTS; successfully, follow these steps:

  1. Add AEM Mocks Dependency: Include the AEM Mocks library as a test dependency in your project's pom.xml file:

<dependency>
<groupId>io.wcm.testing</groupId>
<artifactId>aem-mock</artifactId>
<version>1.11.0</version>
<scope>test</scope>
</dependency>

 

  1. Configure AEM Mocks Context: Set up the AEM Mocks context in your test class using the AemContext rule:

import io.wcm.testing.mock.aem.junit.AemContext;

public class MyTest {
@Rule
public final AemContext context = new AemContext();

// Your test methods here
}

Avatar

Community Advisor

@sreenu539 solution provided by @ManviSharma should work.. please try and let us know if you still need our help.

Avatar

Level 7

I am specifically looking to cover "super typed core teaser" as part of junit.