From 143ddcc19fd530bd47be2eda0ab7fadeae7ae74a Mon Sep 17 00:00:00 2001 From: mumbler6 Date: Wed, 16 Oct 2024 19:15:39 -0500 Subject: [PATCH] fixed flaky test in testDisabledModule() --- .../DefaultJsonJacksonProviderForBothModulesTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/media/json-jackson/src/test/java/org/glassfish/jersey/jackson/internal/DefaultJsonJacksonProviderForBothModulesTest.java b/media/json-jackson/src/test/java/org/glassfish/jersey/jackson/internal/DefaultJsonJacksonProviderForBothModulesTest.java index 9d86b842b2..fe74a94dd3 100644 --- a/media/json-jackson/src/test/java/org/glassfish/jersey/jackson/internal/DefaultJsonJacksonProviderForBothModulesTest.java +++ b/media/json-jackson/src/test/java/org/glassfish/jersey/jackson/internal/DefaultJsonJacksonProviderForBothModulesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -23,6 +23,9 @@ import javax.ws.rs.core.Application; +import java.util.List; +import java.util.Arrays; +import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertEquals; public class DefaultJsonJacksonProviderForBothModulesTest extends JerseyTest { @@ -36,8 +39,12 @@ protected final Application configure() { public final void testDisabledModule() { final String response = target("entity/simple") .request().get(String.class); + String expected = "{\"name\":\"Hello\",\"value\":\"World\"}"; + List response_list = Arrays.asList(response.replaceAll("[{}]", "").split(",")); + List expected_list = Arrays.asList(expected.replaceAll("[{}]", "").split(",")); + Collections.sort(response_list); - assertEquals("{\"name\":\"Hello\",\"value\":\"World\"}", response); + assertEquals(expected_list, response_list); } }