From 73a80e64d74b772f3bd9246f153bf2cabe3ca248 Mon Sep 17 00:00:00 2001 From: Benjamin Guan <47118893+mumbler6@users.noreply.github.com> Date: Fri, 15 Nov 2024 05:06:14 -0600 Subject: [PATCH] changed HashSet to LinkedHashSet to fix flaky test (#52) Co-authored-by: Stefan Seifert --- changes.xml | 3 +++ core/src/main/java/io/wcm/testing/mock/aem/MockTagManager.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changes.xml b/changes.xml index 894e1150..be2d1ae2 100644 --- a/changes.xml +++ b/changes.xml @@ -27,6 +27,9 @@ Update to latest OSGi Mock. + + MockTagManager.getTagsForSubtree: Ensure stable order of result list. + diff --git a/core/src/main/java/io/wcm/testing/mock/aem/MockTagManager.java b/core/src/main/java/io/wcm/testing/mock/aem/MockTagManager.java index 0aaf8887..12d26815 100644 --- a/core/src/main/java/io/wcm/testing/mock/aem/MockTagManager.java +++ b/core/src/main/java/io/wcm/testing/mock/aem/MockTagManager.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -377,7 +378,7 @@ private Collection collectResourceTags(Resource resource, boolean recurse) if (resource == null) { return Collections.emptyList(); } - Set treeTags = new HashSet<>(); + Set treeTags = new LinkedHashSet<>(); Queue searchResources = new LinkedList<>(); searchResources.add(resource);