Introduce @Disabled AOT tests for @TestBean support
See gh-32933
This commit is contained in:
@@ -145,11 +145,25 @@ class AotIntegrationTests extends AbstractAotTests {
|
||||
runEndToEndTests(testClasses, false);
|
||||
}
|
||||
|
||||
@Disabled("Comment out to run @TestBean integration tests in AOT mode")
|
||||
@Test
|
||||
void endToEndTestsForTestBeanOverrideTestClasses() {
|
||||
List<Class<?>> testClasses = List.of(
|
||||
org.springframework.test.context.aot.samples.bean.override.convention.TestBeanJupiterTests.class,
|
||||
org.springframework.test.context.bean.override.convention.TestBeanForByNameLookupIntegrationTests.class,
|
||||
org.springframework.test.context.bean.override.convention.TestBeanForByNameLookupIntegrationTests.TestBeanFieldInEnclosingClassTests.class,
|
||||
org.springframework.test.context.bean.override.convention.TestBeanForByNameLookupIntegrationTests.TestBeanFieldInEnclosingClassTests.TestBeanFieldInEnclosingClassLevel2Tests.class,
|
||||
org.springframework.test.context.bean.override.convention.TestBeanForByNameLookupIntegrationTests.TestBeanFactoryMethodInEnclosingClassTests.class,
|
||||
org.springframework.test.context.bean.override.convention.TestBeanForByNameLookupIntegrationTests.TestBeanFactoryMethodInEnclosingClassTests.TestBeanFactoryMethodInEnclosingClassLevel2Tests.class
|
||||
);
|
||||
|
||||
runEndToEndTests(testClasses, true);
|
||||
}
|
||||
|
||||
@Disabled("Comment out to run selected integration tests in AOT mode")
|
||||
@Test
|
||||
void endToEndTestsForSelectedTestClasses() {
|
||||
List<Class<?>> testClasses = List.of(
|
||||
org.springframework.test.context.bean.override.convention.TestBeanForByNameLookupIntegrationTests.class,
|
||||
org.springframework.test.context.bean.override.mockito.MockitoBeanForByNameLookupIntegrationTests.class,
|
||||
org.springframework.test.context.junit4.SpringJUnit4ClassRunnerAppCtxTests.class,
|
||||
org.springframework.test.context.junit4.ParameterizedDependencyInjectionTests.class
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2002-2024 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.context.aot.samples.bean.override.convention;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.bean.override.convention.TestBean;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Sam Brannen
|
||||
* @since 6.2
|
||||
*/
|
||||
@SpringJUnitConfig
|
||||
public class TestBeanJupiterTests {
|
||||
|
||||
@TestBean
|
||||
String magicBean;
|
||||
|
||||
static String magicBean() {
|
||||
return "enigma-override";
|
||||
}
|
||||
|
||||
@Test
|
||||
void tests() {
|
||||
assertThat(magicBean).isEqualTo("enigma-override");
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
String magicBean() {
|
||||
return "enigma";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class TestBeanForByNameLookupIntegrationTests {
|
||||
|
||||
@Nested
|
||||
@DisplayName("With @TestBean in the enclosing class of the enclosing class")
|
||||
class TestBeanFieldInEnclosingClassLevel2Tests {
|
||||
public class TestBeanFieldInEnclosingClassLevel2Tests {
|
||||
|
||||
@Test
|
||||
void fieldHasOverride(ApplicationContext ctx) {
|
||||
@@ -130,7 +130,7 @@ public class TestBeanForByNameLookupIntegrationTests {
|
||||
|
||||
@Nested
|
||||
@DisplayName("With factory method in enclosing class")
|
||||
class TestBeanFactoryMethodInEnclosingClassTests {
|
||||
public class TestBeanFactoryMethodInEnclosingClassTests {
|
||||
|
||||
@TestBean(methodName = "nestedField", name = "nestedField")
|
||||
String nestedField2;
|
||||
@@ -143,7 +143,7 @@ public class TestBeanForByNameLookupIntegrationTests {
|
||||
|
||||
@Nested
|
||||
@DisplayName("With factory method in the enclosing class of the enclosing class")
|
||||
class TestBeanFactoryMethodInEnclosingClassLevel2Tests {
|
||||
public class TestBeanFactoryMethodInEnclosingClassLevel2Tests {
|
||||
|
||||
@TestBean(methodName = "nestedField", name = "nestedField")
|
||||
String nestedField2;
|
||||
|
||||
Reference in New Issue
Block a user