Adds spring-boot-testcontainers and testcontainers-postgresql deps. PostgresContainerConfig declares a shared @ServiceConnection container used by DocumentRepositoryTest, PersonRepositoryTest, and an ApplicationContextTest smoke test. Flyway migrations are imported via FlywayConfig and run on every test execution, verifying the migration chain against a real PostgreSQL 16 container. No H2 is used. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
915 B
Java
26 lines
915 B
Java
package org.raddatz.familienarchiv;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
|
import org.springframework.context.annotation.Import;
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
|
import org.testcontainers.containers.PostgreSQLContainer;
|
|
import software.amazon.awssdk.services.s3.S3Client;
|
|
|
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
|
@ActiveProfiles("test")
|
|
@Import(PostgresContainerConfig.class)
|
|
class ApplicationContextTest {
|
|
|
|
@MockitoBean
|
|
S3Client s3Client;
|
|
|
|
@Test
|
|
void contextLoads() {
|
|
// verifies that the Spring context starts successfully with all beans wired,
|
|
// Flyway migrations applied, and no configuration errors
|
|
}
|
|
}
|