adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
726 stars 735 forks source link

[EmbedUrlProcessorServlet] Non-deterministic behavior of Class.getDeclaredFields() might fail test EmbedUrlProcessorServletTest.testUrlWithRegisteredProvider() #2611

Closed SaaiVenkat closed 6 months ago

SaaiVenkat commented 8 months ago

Bug Report

Current Behavior

Steps to reproduce

Compile the module byte-buddy-dep

mvn clean install -pl bundles/core -am -DskipTests

(Optional) Run the unit test

mvn -pl bundles/core test -Dtest=com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbedUrlProcessorServletTest#testUrlWithRegisteredProvider

Run the unit test using NonDex

mvn -pl bundles/core edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbedUrlProcessorServletTest#testUrlWithRegisteredProvider


**Expected behavior/code**
- For any amount of runs, the test should have passes successfully (with `NonDex` too). 
- The expected order of elements might not necessarily be `processor` followed by `options`. 

**Environment**
- Core Components version: `2.23.5-SNAPSHOT`
- Java version: `Java(TM) SE Runtime Environment (build 1.8.0_381-b09)`

**Possible Solution 1**
- Since the test validates the data of the json and not the order, we can convert the strings to `JsonNode` and compare the nodes.

+/- com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbedUrlProcessorServletTest.testUrlWithRegisteredProvider()