From 11d2c457e7bc32cc3670dbedc6a47503757fdd6f Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Wed, 7 Oct 2026 11:50:12 +0200 Subject: [PATCH] Fix ignored target assertions in ConcurrencyLimitTests The rejection tests verified the exception target with `satisfies(ex -> assertThat(ex.getTarget() == target))`, which never asserts anything as the boolean `assertThat` is not followed by a check. Assert the target via `extracting(...).isSameAs(...)` instead, against the proxy, since the concurrency throttle is applied at the AOP proxy level and the proxy is what gets passed as the exception target. Closes gh-37411 Signed-off-by: Tim te Beek --- .../springframework/resilience/ConcurrencyLimitTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-context/src/test/java/org/springframework/resilience/ConcurrencyLimitTests.java b/spring-context/src/test/java/org/springframework/resilience/ConcurrencyLimitTests.java index 799d08a5301..f49246fc348 100644 --- a/spring-context/src/test/java/org/springframework/resilience/ConcurrencyLimitTests.java +++ b/spring-context/src/test/java/org/springframework/resilience/ConcurrencyLimitTests.java @@ -137,7 +137,7 @@ class ConcurrencyLimitTests { futures.add(CompletableFuture.runAsync(() -> assertThatExceptionOfType(InvocationRejectedException.class).isThrownBy(proxy::rejectingOperation) .withMessageContaining(AnnotatedMethodBean.class.getName() + ".rejectingOperation") - .satisfies(ex -> assertThat(ex.getTarget() == target)))); + .extracting(InvocationRejectedException::getTarget).isSameAs(proxy))); } CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); assertThat(target.current).hasValue(2); @@ -178,11 +178,11 @@ class ConcurrencyLimitTests { futures.add(CompletableFuture.runAsync(() -> assertThatExceptionOfType(InvocationRejectedException.class).isThrownBy(proxy::concurrentOperation) .withMessageContaining(AnnotatedClassBeanWithRejection.class.getName()) - .satisfies(ex -> assertThat(ex.getTarget() == target)))); + .extracting(InvocationRejectedException::getTarget).isSameAs(proxy))); futures.add(CompletableFuture.runAsync(() -> assertThatExceptionOfType(InvocationRejectedException.class).isThrownBy(proxy::otherOperation) .withMessageContaining(AnnotatedClassBeanWithRejection.class.getName()) - .satisfies(ex -> assertThat(ex.getTarget() == target)))); + .extracting(InvocationRejectedException::getTarget).isSameAs(proxy))); for (int i = 0; i < 4; i++) { futures.add(CompletableFuture.runAsync(proxy::overrideOperation)); }