From 2193b2b23d1ef559c6ae6609ed7f63dae3605bad Mon Sep 17 00:00:00 2001 From: mumbler6 Date: Mon, 21 Oct 2024 18:50:28 -0500 Subject: [PATCH 1/3] Fixed flaky test in DisposableSupplierText.java with set comparison --- .../inject/cdi/se/DisposableSupplierTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java b/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java index 69d68eb2470..db01ea031bc 100644 --- a/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java +++ b/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java @@ -17,6 +17,8 @@ package org.glassfish.jersey.inject.cdi.se; import java.lang.reflect.Type; +import java.util.HashSet; +import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; @@ -368,9 +370,17 @@ public void testDisposeComposedObjectWithPerLookupFields() { // All instances should be the same because they are request scoped. ComposedObject instance = injectionManager.getInstance(ComposedObject.class); - assertEquals("1", instance.getFirst()); - assertEquals("2", instance.getSecond()); - assertEquals("3", instance.getThird()); + Set set1 = new HashSet() {{ + add("1"); + add("2"); + add("3"); + }}; + Set set2 = new HashSet() {{ + add(instance.getFirst().toString()); + add(instance.getSecond().toString()); + add(instance.getThird().toString()); + }}; + assertEquals(set1, set2); }); Supplier cleanedSupplier = atomicSupplier.get(); From ee210e0de5d1d38ccc74f7c5646f8429c3728f3a Mon Sep 17 00:00:00 2001 From: mumbler6 Date: Mon, 21 Oct 2024 20:57:07 -0500 Subject: [PATCH 2/3] Fixed duplicate flaky test in other file path --- .../inject/hk2/DisposableSupplierTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java b/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java index 9eefe4889a7..58fc393a88c 100644 --- a/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java +++ b/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java @@ -17,6 +17,8 @@ package org.glassfish.jersey.inject.hk2; import java.lang.reflect.Type; +import java.util.HashSet; +import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; @@ -374,9 +376,17 @@ public void testDisposeComposedObjectWithPerLookupFields() { // All instances should be the same because they are request scoped. ComposedObject instance = injectionManager.getInstance(ComposedObject.class); - assertEquals("1", instance.first); - assertEquals("2", instance.second); - assertEquals("3", instance.third); + Set set1 = new HashSet() {{ + add("1"); + add("2"); + add("3"); + }}; + Set set2 = new HashSet() {{ + add(instance.first.toString()); + add(instance.second.toString()); + add(instance.third.toString()); + }}; + assertEquals(set1, set2); }); Supplier cleanedSupplier = atomicSupplier.get(); From 562658332e8e1a4cbbe61f8b9743ad611e76279f Mon Sep 17 00:00:00 2001 From: mumbler6 Date: Mon, 21 Oct 2024 21:34:52 -0500 Subject: [PATCH 3/3] fixed copyright --- .../glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java | 2 +- .../org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java b/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java index db01ea031bc..5dc78bc3732 100644 --- a/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java +++ b/inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/DisposableSupplierTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java b/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java index 58fc393a88c..5a2d86968b0 100644 --- a/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java +++ b/inject/hk2/src/test/java/org/glassfish/jersey/inject/hk2/DisposableSupplierTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at