Hi Everyone,
I have updated the mockito version from 3.3.3 to 4.11.0 and my existing test cases started to break. I am getting below error:
ERROR!
java.lang.IllegalArgumentException: Illegal page name.
at createPage(ModelTest.java:74)
I am creating page from aemContext as aemContext.create().page("/content/test/us/en/home");
I tried to update the io.wcm.testing.aem-mock.junit5 version to 5.0.0, still getting the same error.
Regards
Kanika
Solved! Go to Solution.
Views
Replies
Total Likes
Well, I would raise a question in maling list of https://wcm.io/ project. In my humble opinion it is an issue of incompatiblity between mockito 3.x and newer
Can provide full stacktrace ? Have you used an IDE to check for possible compile errors?
In eclipse I am not seeing any errors. But when I am doing maven build it is failing and below errors are coming:
[ERROR] SearchModelTest.setUp:38->createPage:46 » IllegalArgument Illegal page name.
[ERROR] SearchModelTest.setUp:38->createPage:46 » IllegalArgument Illegal page name.
[ERROR] SearchModelTest.setUp:38->createPage:46 » IllegalArgument Illegal page name.
[ERROR] SearchModelTest.setUp:38->createPage:46 » IllegalArgument Illegal page name.
That is not a stacktrace. To solve the issue think simple:
Conclusion:
In lifecycle of software development is does happen often, there are fundamental changes in newer versions of framework. So you have to dig in into the stacktrace and look in wich of your class and method the exception raise. Use the debug fearture from your IDE and the documentation from mockito framework to solve it.
I already debug it and in IDE there are no errors and test cases are pass. Also when I try to run single test case through maven it is pass. Also I checked the mockito documentation nothing is mentioned related to aemContext. As I already mentioned that error is coming while creatin page from aemContext:
aemContext.create().page("/content/test/us/en/home");
java.lang.IllegalArgumentException: Illegal page name.
at io.wcm.testing.mock.aem.MockPageManager.create(MockPageManager.java:100)
at io.wcm.testing.mock.aem.builder.ContentBuilder.page(ContentBuilder.java:148)
at io.wcm.testing.mock.aem.builder.ContentBuilder.page(ContentBuilder.java:102)
I upgraded the version of io.wcm as well but no luck.
Well, I would raise a question in maling list of https://wcm.io/ project. In my humble opinion it is an issue of incompatiblity between mockito 3.x and newer
Can you please debug and check if the aemContext is coming or not? Also please check the exact log on what it is saying.
Hope this helps!
Thanks,
Kiran Vedantam.
Yes aemContext is coming and only those test cases are failing where I have used aemContext.create().page("/content/test/us/en/home") and it was working fine with mockito 3.3.3 version.
Getting page from pageManager is working fine like aemContext.pageManager().getPage(pagePath) is working.
@kanikaa32870678 Probably the path might be invalid. Also, check the arguments that need to be passed to the function.
Page page = context.pageManager().create("/content/test/...", ...);
Path is correct, it was working fine with mockito 3.3.3 and I am creating page directly from aemcontext as aemContext.create().page("/content/test/us/en/home") .
Views
Likes
Replies
Views
Likes
Replies