diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b69aa04 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: Checks +on: [push, pull_request] +jobs: + build: + name: Integration Tests + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 22 + cache: 'maven' + - name: Build with Maven + run: mvn -B test \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6ebd5e4..88e9407 100644 --- a/pom.xml +++ b/pom.xml @@ -14,14 +14,13 @@ org.springframework.boot spring-boot-starter-parent - 2.5.1 + 3.3.2 UTF-8 UTF-8 - 1.8 @@ -33,6 +32,10 @@ org.flywaydb flyway-core + + org.flywaydb + flyway-database-postgresql + org.postgresql postgresql @@ -43,10 +46,15 @@ spring-boot-starter-test test + + org.junit.jupiter + junit-jupiter-engine + test + io.zonky.test embedded-database-spring-test - 2.0.1 + 2.5.1 test @@ -56,13 +64,6 @@ org.apache.maven.plugins maven-surefire-plugin - - - org.apache.maven.surefire - surefire-junit47 - ${maven-surefire-plugin.version} - - org.springframework.boot diff --git a/src/main/java/com/github/tomix26/embedded/database/demo/domain/Person.java b/src/main/java/com/github/tomix26/embedded/database/demo/domain/Person.java index ef6e35a..db92bbc 100644 --- a/src/main/java/com/github/tomix26/embedded/database/demo/domain/Person.java +++ b/src/main/java/com/github/tomix26/embedded/database/demo/domain/Person.java @@ -1,9 +1,9 @@ package com.github.tomix26.embedded.database.demo.domain; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; @Entity @Table(schema = "test", name = "person") diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2f837a1..501fcb5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,2 @@ -spring.flyway.schemas=test \ No newline at end of file +spring.flyway.schemas=test +zonky.test.database.postgres.docker.image=postgres:16-alpine \ No newline at end of file diff --git a/src/test/java/com/github/tomix26/embedded/database/demo/CustomDataJpaAnnotationTest.java b/src/test/java/com/github/tomix26/embedded/database/demo/CustomDataJpaAnnotationTest.java index 95122e3..f0c2ff2 100644 --- a/src/test/java/com/github/tomix26/embedded/database/demo/CustomDataJpaAnnotationTest.java +++ b/src/test/java/com/github/tomix26/embedded/database/demo/CustomDataJpaAnnotationTest.java @@ -3,16 +3,13 @@ import com.github.tomix26.embedded.database.demo.annotation.PostgresDataJpaTest; import com.github.tomix26.embedded.database.demo.domain.Person; import com.github.tomix26.embedded.database.demo.domain.PersonRepository; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.junit4.SpringRunner; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringRunner.class) @PostgresDataJpaTest // custom composite annotation public class CustomDataJpaAnnotationTest { diff --git a/src/test/java/com/github/tomix26/embedded/database/demo/SpringDataJpaAnnotationTest.java b/src/test/java/com/github/tomix26/embedded/database/demo/SpringDataJpaAnnotationTest.java index 984bf6e..c55b16b 100644 --- a/src/test/java/com/github/tomix26/embedded/database/demo/SpringDataJpaAnnotationTest.java +++ b/src/test/java/com/github/tomix26/embedded/database/demo/SpringDataJpaAnnotationTest.java @@ -3,17 +3,14 @@ import com.github.tomix26.embedded.database.demo.domain.Person; import com.github.tomix26.embedded.database.demo.domain.PersonRepository; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.junit4.SpringRunner; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringRunner.class) @DataJpaTest @AutoConfigureEmbeddedDatabase public class SpringDataJpaAnnotationTest {