wcm.io Junit testing getting error | Community
Skip to main content
Level 2
June 1, 2017
Solved

wcm.io Junit testing getting error

  • June 1, 2017
  • 2 replies
  • 1780 views

Hi Guys,

I am trying to use wcm.io tool for Junit testing but its not working for me getting error:

java.lang.RuntimeException: Unable to invoke method 'bindInjector' for class org.apache.sling.models.impl.ModelAdapterFactory

I have used this code:

@RunWith(MockitoJUnitRunner.class)

public class MyDictionaryTest {

  @Rule

   public final AemContext context = new AemContext();

 

  @BeforeClass

  public static void beforeClass(){

  System.out.println("Before Class");

  }

@Before

  public void before(){

  System.out.println("Before Test Case");

  }

@Test

  public void isGreaterTest(){

  System.out.println("Test");

  MyDictionary helloWorld = new MyDictionary();

  assertTrue("Num 1 is greater than Num 2" , helloWorld.isGreater(5, 3));

}

@After

public void after(){

  System.out.println("After Test Case");

}

public void afterClass(){

  System.out.println("After Class");

}

}

Kindly help me to resolve it

Thanks

meenal

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

Have a look at the core-components, we have unit-tests are in there: GitHub - Adobe-Marketing-Cloud/aem-core-wcm-components: AEM Core WCM Components

2 replies

smacdonald2008
Level 10
June 1, 2017

Here is a GEMS session on this subject that you may find helpful: From Unit Testing to Integration Test of an AEM Application

Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
June 1, 2017

Have a look at the core-components, we have unit-tests are in there: GitHub - Adobe-Marketing-Cloud/aem-core-wcm-components: AEM Core WCM Components