Skip to content

Commit

Permalink
replace hamcrest with assertj
Browse files Browse the repository at this point in the history
  • Loading branch information
fil512 committed May 22, 2024
1 parent 993346c commit 66138f9
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);

}
Expand Down Expand Up @@ -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();
}

}

0 comments on commit 66138f9

Please sign in to comment.