Expand my Community achievements bar.

SOLVED

WCmUse / WCMUsePojo mocking in Junit

Avatar

Level 3

Hi All,
Have anybody implemented JUnit test cases for classes which are extending to WCMUsePojo?
I am getting below error while mocking WCMUsePojo..

java.lang.VerifyError: Constructor must call super() or this() before return
Exception Details:
Location:
com/adobe/cq/sightly/WCMUsePojo.<init>()V @9: return
Please provide some inputs why this exception.
FYI : I am using Mockito for mocking.

Thanks in Advance.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hey Shiva,

Looks like you need to use unobfuscated uber jar to run this unit test [1](otherwise it won't compile and you would get the error you are getting now)

[1] https://docs.adobe.com/docs/en/aem/6-1/develop/dev-tools/ht-projects-maven.html#I%20understand%20the...?

Regards,

Peter

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hey Shiva,

Looks like you need to use unobfuscated uber jar to run this unit test [1](otherwise it won't compile and you would get the error you are getting now)

[1] https://docs.adobe.com/docs/en/aem/6-1/develop/dev-tools/ht-projects-maven.html#I%20understand%20the...?

Regards,

Peter

Avatar

Level 3

Hello Peter,

Thank you for the information..

 

Regards,

Shivamurthy MN

Avatar

Level 1

HI PuzanovsP​,

Thanks for posting, it helps me also.

Avatar

Level 2

Hi,

I'm facing similar issue after 6.3 upgrade even though i'm using obfuscated-apis. 

<groupId>com.adobe.aem</groupId>

  <artifactId>uber-jar</artifactId>

  <version>6.3.0</version>

  <classifier>obfuscated-apis</classifier>

  <scope>provided</scope>

java.lang.VerifyError: Constructor must call super() or this() before return

Exception Details:

  Location:

    com/adobe/cq/sightly/WCMUsePojo.<init>()V @1: return

  Reason:

    Error exists in the bytecode

  Bytecode:

    0x0000000: 2ab1