From 66138f96a7e28e62e9ebb0e9ed2e20cb937acf8c Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Wed, 22 May 2024 15:36:15 -0400 Subject: [PATCH] replace hamcrest with assertj --- .../test/concurrency/LockstepEnumPhaserTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hapi-fhir-test-utilities/src/test/java/ca/uhn/test/concurrency/LockstepEnumPhaserTest.java b/hapi-fhir-test-utilities/src/test/java/ca/uhn/test/concurrency/LockstepEnumPhaserTest.java index 4a0ced96b32f..0bbca0a7a125 100644 --- a/hapi-fhir-test-utilities/src/test/java/ca/uhn/test/concurrency/LockstepEnumPhaserTest.java +++ b/hapi-fhir-test-utilities/src/test/java/ca/uhn/test/concurrency/LockstepEnumPhaserTest.java @@ -24,7 +24,6 @@ import static ca.uhn.test.concurrency.LockstepEnumPhaserTest.Stages.THREE; import static ca.uhn.test.concurrency.LockstepEnumPhaserTest.Stages.TWO; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; // All of these should run pretty quickly - 5s should be lots. @@ -95,7 +94,7 @@ void phaserWithTwoThreads_runsInLockStep() throws InterruptedException, Executio assertEquals(1, result1.get()); assertEquals(1, result2.get()); - assertThat("progress is ordered", myProgressEvents, OrderMatchers.softOrdered(myProgressStageComparator)); + assertEventsAreOrdered(); assertThat(myProgressEvents).as("all progress logged").hasSize(6); } @@ -161,7 +160,7 @@ void phaserWithTwoThreads_canAddThird_sequencContinues() throws InterruptedExcep assertEquals(1, result1.get()); assertEquals(3, result3.get()); - assertThat("progress is ordered", myProgressEvents, OrderMatchers.softOrdered(myProgressStageComparator)); + assertEventsAreOrdered(); assertThat(myProgressEvents).as("all progress logged").hasSize(8); } @@ -227,9 +226,16 @@ void aShortScheduleDeregister_allowsRemainingParticipantsToContinue() throws Exe assertEquals(2, result2.get()); assertEquals(3, result3.get()); - assertThat("progress is ordered", myProgressEvents, OrderMatchers.softOrdered(myProgressStageComparator)); + assertEventsAreOrdered(); assertThat(myProgressEvents).as("all progress logged").hasSize(2 * 3 + 2); } + private void assertEventsAreOrdered() { + assertThat(myProgressEvents) + .as("progress is ordered") + .usingElementComparator(myProgressStageComparator) + .isSorted(); + } + }