Browse Source

Test that @TestConstructor can be used as a meta-annotation

pull/24924/head
Sam Brannen 5 years ago
parent
commit
0017256968
  1. 21
      spring-test/src/test/java/org/springframework/test/context/support/TestConstructorUtilsTests.java

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

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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 { @@ -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 { @@ -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 {
}

Loading…
Cancel
Save