diff --git a/pom.xml b/pom.xml index 90d74a32..567389ba 100644 --- a/pom.xml +++ b/pom.xml @@ -139,6 +139,14 @@ com.h2database h2 + + org.testcontainers + junit-jupiter + + + org.testcontainers + postgresql + org.springframework.boot spring-boot-starter-test diff --git a/src/test/java/com/hendisantika/sekolah/SekolahApplicationTests.java b/src/test/java/com/hendisantika/sekolah/SekolahApplicationTests.java index 833b7781..12541ee3 100644 --- a/src/test/java/com/hendisantika/sekolah/SekolahApplicationTests.java +++ b/src/test/java/com/hendisantika/sekolah/SekolahApplicationTests.java @@ -2,8 +2,10 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import org.testcontainers.junit.jupiter.Testcontainers; -@SpringBootTest +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) +@Testcontainers class SekolahApplicationTests { @Test diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml new file mode 100644 index 00000000..17682e71 --- /dev/null +++ b/src/test/resources/application.yml @@ -0,0 +1,9 @@ +spring: + datasource: + url: jdbc:tc:postgresql:16.2-alpine3.19:///sekolah + username: yuji + password: itadori + jpa: + hibernate: + ddl-auto: validate + show-sql: true