Junit Mockito 3.4 upgrade issue | Community
Skip to main content
Level 3
January 23, 2023

Junit Mockito 3.4 upgrade issue

  • January 23, 2023
  • 4 replies
  • 2241 views

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

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

4 replies

Himanshu_Singhal
Community Advisor
Community Advisor
January 23, 2023

Hi @parakhma 
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

 

ParakhMaAuthor
Level 3
January 23, 2023

Yes, we did.

The error remains exactly the same

Kiran_Vedantam
Community Advisor
Community Advisor
January 23, 2023

Hi @parakhma 

 

Similar issue is posted here:: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/java-lang-illegalargumentexception-illegal-page-name-error-while/m-p/568046#M141856

 

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


Thanks,
Kiran Vedantam.

shelly-goel
Adobe Employee
Adobe Employee
January 23, 2023
Kamal_Kishor
Community Advisor
Community Advisor
August 1, 2024

I am seeing this with version 5.1.2 and error is java.lang.IllegalArgumentException: Illegal page name.

 

io.wcm.testing.aem-mock.junit5 version: 5.1.2