Skip to content

Commit 0017256

Browse files
committed
Test that @Testconstructor can be used as a meta-annotation
1 parent df291a3 commit 0017256

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

spring-test/src/test/java/org/springframework/test/context/support/TestConstructorUtilsTests.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,10 @@
1616

1717
package org.springframework.test.context.support;
1818

19+
import java.lang.annotation.ElementType;
20+
import java.lang.annotation.Retention;
21+
import java.lang.annotation.RetentionPolicy;
22+
import java.lang.annotation.Target;
1923
import java.lang.reflect.Constructor;
2024

2125
import org.junit.jupiter.api.AfterEach;
@@ -57,6 +61,11 @@ void testConstructorAnnotation() throws Exception {
5761
assertAutowirable(TestConstructorAnnotationTestCase.class);
5862
}
5963

64+
@Test
65+
void testConstructorAsMetaAnnotation() throws Exception {
66+
assertAutowirable(TestConstructorAsMetaAnnotationTestCase.class);
67+
}
68+
6069
@Test
6170
void automaticallyAutowired() throws Exception {
6271
setGlobalFlag();
@@ -125,6 +134,16 @@ static class AutowiredAnnotationTestCase {
125134
static class TestConstructorAnnotationTestCase {
126135
}
127136

137+
@Target(ElementType.TYPE)
138+
@Retention(RetentionPolicy.RUNTIME)
139+
@TestConstructor(autowireMode = ALL)
140+
@interface AutowireConstructor {
141+
}
142+
143+
@AutowireConstructor
144+
static class TestConstructorAsMetaAnnotationTestCase {
145+
}
146+
128147
static class AutomaticallyAutowiredTestCase {
129148
}
130149

0 commit comments

Comments
 (0)