mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-21 13:31:46 +00:00
Introduce isAutowirableConstructor(Executable,PropertyProvider) in TestConstructorUtils
This commit introduces a new isAutowirableConstructor(Executable, PropertyProvider) overload in TestConstructorUtils and deprecates all other existing variants for removal in 7.1. Closes gh-35676
This commit is contained in:
+5
-2
@@ -41,6 +41,9 @@ import static org.springframework.test.context.TestConstructor.AutowireMode.ANNO
|
||||
*/
|
||||
class TestConstructorUtilsTests {
|
||||
|
||||
private static final PropertyProvider propertyProvider = name -> null;
|
||||
|
||||
|
||||
@AfterEach
|
||||
void clearGlobalFlag() {
|
||||
setGlobalFlag(null);
|
||||
@@ -100,12 +103,12 @@ class TestConstructorUtilsTests {
|
||||
|
||||
private void assertAutowirable(Class<?> testClass) throws NoSuchMethodException {
|
||||
Constructor<?> constructor = testClass.getDeclaredConstructor();
|
||||
assertThat(TestConstructorUtils.isAutowirableConstructor(constructor, testClass)).isTrue();
|
||||
assertThat(TestConstructorUtils.isAutowirableConstructor(constructor, propertyProvider)).isTrue();
|
||||
}
|
||||
|
||||
private void assertNotAutowirable(Class<?> testClass) throws NoSuchMethodException {
|
||||
Constructor<?> constructor = testClass.getDeclaredConstructor();
|
||||
assertThat(TestConstructorUtils.isAutowirableConstructor(constructor, testClass)).isFalse();
|
||||
assertThat(TestConstructorUtils.isAutowirableConstructor(constructor, propertyProvider)).isFalse();
|
||||
}
|
||||
|
||||
private void setGlobalFlag() {
|
||||
|
||||
Reference in New Issue
Block a user