diff --git a/spring-test/src/test/java/org/springframework/test/context/support/TestConstructorUtilsTests.java b/spring-test/src/test/java/org/springframework/test/context/support/TestConstructorUtilsTests.java index 860001b4a9..5bcf5767ea 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/TestConstructorUtilsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/TestConstructorUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,10 @@ package org.springframework.test.context.support; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.lang.reflect.Constructor; import org.junit.jupiter.api.AfterEach; @@ -57,6 +61,11 @@ class TestConstructorUtilsTests { assertAutowirable(TestConstructorAnnotationTestCase.class); } + @Test + void testConstructorAsMetaAnnotation() throws Exception { + assertAutowirable(TestConstructorAsMetaAnnotationTestCase.class); + } + @Test void automaticallyAutowired() throws Exception { setGlobalFlag(); @@ -125,6 +134,16 @@ class TestConstructorUtilsTests { static class TestConstructorAnnotationTestCase { } + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + @TestConstructor(autowireMode = ALL) + @interface AutowireConstructor { + } + + @AutowireConstructor + static class TestConstructorAsMetaAnnotationTestCase { + } + static class AutomaticallyAutowiredTestCase { }