anyone successfully used com.adobe.cq.wcm.core.components.testing.mock.ContextPlugins.CORE_COMPONENTS; | Community
Skip to main content
sreenu539
Level 7
May 19, 2023

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

  • May 19, 2023
  • 2 replies
  • 1508 views

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

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

ManviSharma
Adobe Employee
Adobe Employee
May 19, 2023

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
}

Shashi_Mulugu
Community Advisor
Community Advisor
May 21, 2023

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

sreenu539
sreenu539Author
Level 7
May 24, 2023

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