Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Junit Mockito 3.4 upgrade issue

Avatar

Level 4

We have to upgrade the mockito version to atleast 3.4 or any higher.

However the moment we upgrade it all test cases start breaking :

Page page = aemContext.create().page("/content/testPage");

with error 

java.lang.IllegalArgumentException: Illegal page name.

 

This is what our pom looks like after upgrade :

<dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.6.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>5.0.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>5.0.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>junit-addons</groupId>
                <artifactId>junit-addons</artifactId>
                <version>1.4</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>io.wcm</groupId>
                <artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
                <version>3.0.2</version>
                <scope>test</scope>
            </dependency>

 

Same error with mockito 3.4 as well

 <error message="Illegal page name." type="java.lang.IllegalArgumentException">java.lang.IllegalArgumentException: Illegal page name.

 However, it works fine if we keep mockito version to 3.3.3, but an upgrade is required

4 Replies

Avatar

Community Advisor

Hi @maheshp 
Did you try to upgrade following dependency to more latest version e.g. 5.0.0 and gave it a try?

io.wcm.testing.aem-mock.junit5

 

Avatar

Community Advisor

Hi @maheshp 

 

Similar issue is posted here:: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/java-lang-illegalargumente...

 

I think it is with the version upgrade. @kautuk_sahni can you please guide here on how to proceed?


Thanks,
Kiran Vedantam.