Ensure integration tests are suitable for AOT processing

This commit is contained in:
Sam Brannen 2024-09-23 16:18:37 +02:00
parent 7d99790c34
commit 59eaed0b28
5 changed files with 12 additions and 8 deletions

View File

@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @since 6.2
*/
@SpringJUnitConfig
class TestBeanForByTypeLookupIntegrationTests {
public class TestBeanForByTypeLookupIntegrationTests {
@TestBean
ExampleService anyNameForService;

View File

@ -40,14 +40,14 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Sam Brannen
* @since 6.2
*/
class TestBeanForInheritanceIntegrationTests {
public class TestBeanForInheritanceIntegrationTests {
static Pojo enclosingClassBeanOverride() {
return new FakePojo("in enclosing test class");
}
@SpringJUnitConfig
abstract static class AbstractTestBeanIntegrationTestCase {
public abstract static class AbstractTestBeanIntegrationTestCase {
@TestBean(name = "someBean")
Pojo someBean;
@ -70,7 +70,7 @@ class TestBeanForInheritanceIntegrationTests {
return new FakePojo("in superclass");
}
interface Pojo {
public interface Pojo {
default String getValue() {
return "Prod";

View File

@ -40,7 +40,7 @@ import static org.mockito.BDDMockito.when;
*/
@SpringJUnitConfig
@TestMethodOrder(OrderAnnotation.class)
class MockitoBeanForBeanFactoryIntegrationTests {
public class MockitoBeanForBeanFactoryIntegrationTests {
@MockitoBean
private TestBean testBean;
@ -98,7 +98,7 @@ class MockitoBeanForBeanFactoryIntegrationTests {
}
interface TestBean {
public interface TestBean {
String hello();

View File

@ -123,7 +123,7 @@ public class MockitoBeanForByTypeLookupIntegrationTests {
}
interface AnotherService {
public interface AnotherService {
String hello();

View File

@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.aot.DisabledInAotMode;
/**
* Integration tests that verify support for property placeholders in SQL script locations.
@ -29,14 +30,15 @@ import org.springframework.test.context.TestPropertySource;
* @author Sam Brannen
* @since 6.2
*/
@ContextConfiguration(classes = PopulatedSchemaDatabaseConfig.class)
class PropertyPlaceholderSqlScriptsTests {
private static final String SCRIPT_LOCATION = "classpath:org/springframework/test/context/jdbc/${vendor}/data.sql";
@Nested
@ContextConfiguration(classes = PopulatedSchemaDatabaseConfig.class)
@TestPropertySource(properties = "vendor = db1")
@DirtiesContext
@DisabledInAotMode // ${vendor} does not get resolved during AOT processing
class DatabaseOneTests extends AbstractTransactionalTests {
@Test
@ -47,8 +49,10 @@ class PropertyPlaceholderSqlScriptsTests {
}
@Nested
@ContextConfiguration(classes = PopulatedSchemaDatabaseConfig.class)
@TestPropertySource(properties = "vendor = db2")
@DirtiesContext
@DisabledInAotMode // ${vendor} does not get resolved during AOT processing
class DatabaseTwoTests extends AbstractTransactionalTests {
@Test