From 8b8604db7353cd41516a43617da1135a797f083f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 12 Jun 2024 13:34:53 +0200 Subject: [PATCH] Align after merge from 6.1.x --- .../ScheduledAnnotationBeanPostProcessor.java | 1 + ...duledAnnotationBeanPostProcessorTests.java | 51 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java index 1ca58e36c2..cd9cb35d94 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.time.Duration; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.IdentityHashMap; import java.util.LinkedHashSet; import java.util.List; diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java index 820b6841b5..c55a603312 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java @@ -679,6 +679,32 @@ class ScheduledAnnotationBeanPostProcessorTests { } + static ScheduledMethodRunnableAssert assertThatScheduledRunnable(Runnable runnable) { + return new ScheduledMethodRunnableAssert(runnable); + } + + + static class ScheduledMethodRunnableAssert extends AbstractAssert { + + public ScheduledMethodRunnableAssert(Runnable actual) { + super(actual, ScheduledMethodRunnableAssert.class); + assertThat(actual).extracting("runnable").isInstanceOf(ScheduledMethodRunnable.class); + } + + public ScheduledMethodRunnableAssert hasTarget(Object target) { + isNotNull(); + assertThat(actual).extracting("runnable.target").isEqualTo(target); + return this; + } + + public ScheduledMethodRunnableAssert hasMethodName(String name) { + isNotNull(); + assertThat(actual).extracting("runnable.method.name").isEqualTo(name); + return this; + } + } + + static class FixedDelay { @Scheduled(fixedDelay = 5_000) @@ -1019,29 +1045,4 @@ class ScheduledAnnotationBeanPostProcessorTests { } } - static ScheduledMethodRunnableAssert assertThatScheduledRunnable(Runnable runnable) { - return new ScheduledMethodRunnableAssert(runnable); - } - - static class ScheduledMethodRunnableAssert extends AbstractAssert { - - public ScheduledMethodRunnableAssert(Runnable actual) { - super(actual, ScheduledMethodRunnableAssert.class); - assertThat(actual).extracting("runnable").isInstanceOf(ScheduledMethodRunnable.class); - } - - public ScheduledMethodRunnableAssert hasTarget(Object target) { - isNotNull(); - assertThat(actual).extracting("runnable.target").isEqualTo(target); - return this; - } - - public ScheduledMethodRunnableAssert hasMethodName(String name) { - isNotNull(); - assertThat(actual).extracting("runnable.method.name").isEqualTo(name); - return this; - } - - } - }