mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Revert to previous behavior for 7.0.2 (based on Boot/Data impact)
Preparing the revised behavior for 7.1 instead. See gh-31456
This commit is contained in:
+2
-1
@@ -252,7 +252,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) {
|
||||
|
||||
List<ContextConfigurationAttributes> defaultConfigAttributesList =
|
||||
ContextLoaderUtils.resolveDefaultContextConfigurationAttributes(testClass);
|
||||
Collections.singletonList(new ContextConfigurationAttributes(testClass));
|
||||
// for 7.1: ContextLoaderUtils.resolveDefaultContextConfigurationAttributes(testClass);
|
||||
|
||||
ContextLoader contextLoader = resolveContextLoader(testClass, defaultConfigAttributesList);
|
||||
if (logger.isTraceEnabled()) {
|
||||
|
||||
+2
@@ -41,6 +41,7 @@ class ImplicitDefaultConfigClassesBaseTests {
|
||||
@Autowired
|
||||
String greeting1;
|
||||
|
||||
|
||||
@Test
|
||||
void greeting1() {
|
||||
// This class must NOT be annotated with @SpringJUnitConfig or @ContextConfiguration.
|
||||
@@ -49,6 +50,7 @@ class ImplicitDefaultConfigClassesBaseTests {
|
||||
assertThat(greeting1).isEqualTo("TEST 1");
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class DefaultConfig {
|
||||
|
||||
|
||||
+10
-1
@@ -40,6 +40,13 @@ class ImplicitDefaultConfigClassesInheritedTests extends ImplicitDefaultConfigCl
|
||||
@Autowired
|
||||
String greeting2;
|
||||
|
||||
|
||||
// To be removed in favor of base class method in 7.1
|
||||
@Test
|
||||
void greeting1() {
|
||||
assertThat(greeting1).isEqualTo("TEST 2");
|
||||
}
|
||||
|
||||
@Test
|
||||
void greeting2() {
|
||||
// This class must NOT be annotated with @SpringJUnitConfig or @ContextConfiguration.
|
||||
@@ -50,9 +57,11 @@ class ImplicitDefaultConfigClassesInheritedTests extends ImplicitDefaultConfigCl
|
||||
|
||||
@Test
|
||||
void greetings(@Autowired List<String> greetings) {
|
||||
assertThat(greetings).containsExactly("TEST 1", "TEST 2");
|
||||
assertThat(greetings).containsExactly("TEST 2");
|
||||
// for 7.1: assertThat(greetings).containsExactly("TEST 1", "TEST 2");
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class DefaultConfig {
|
||||
|
||||
|
||||
+5
-1
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.test.context.junit.jupiter.nested;
|
||||
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@@ -43,6 +42,7 @@ class DefaultContextConfigurationDetectionWithNestedTests {
|
||||
@Autowired
|
||||
String greeting;
|
||||
|
||||
|
||||
@Test
|
||||
void test(@Autowired String localGreeting) {
|
||||
// This class must NOT be annotated with @SpringJUnitConfig or @ContextConfiguration.
|
||||
@@ -52,6 +52,8 @@ class DefaultContextConfigurationDetectionWithNestedTests {
|
||||
assertThat(localGreeting).isEqualTo("TEST");
|
||||
}
|
||||
|
||||
|
||||
/** for 7.1:
|
||||
@Nested
|
||||
class NestedTests {
|
||||
|
||||
@@ -61,6 +63,8 @@ class DefaultContextConfigurationDetectionWithNestedTests {
|
||||
assertThat(localGreeting).isEqualTo("TEST");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@Configuration
|
||||
static class DefaultConfig {
|
||||
|
||||
Reference in New Issue
Block a user