This is the second video of the @DataJpaTest mini-series. We'll replace the default H2 in-memory database with PostgreSQL and use Testcontainers for this purpose.
Important hint: The @DynamicPropertSource is available since Spring Boot 2.2.6 (https://rieckpil.de/howto-write-sprin...)
Part I: • Introduction to @DataJpaTest and Pitfalls ...
Part II: • Replacing the Default In-Memory Database o...
Part III: • Test a Native Query of Your Spring Data JP...
Part IV: • Short And Concise Test Setup With @DataJpa...
Source code: https://github.com/rieckpil/blog-tuto...
Content:
0:00 Overriding the default H2 in-memory database for @DataJpaTest
1:08 Introducing Testcontainers to start a local PostgreSQL inside a Docker container
3:00 Adding the required Testcontainers setup to our test
5:12 Dynamically override the JDBC URL
7:00 First successful test run with PostgreSQL
More testing related content is available on my blog: https://rieckpil.de/
» For more deep-dive into testing your Spring Boot persistence layer, consider joining the Testing Spring Boot Applications Masterclass: https://rieckpil.de/testing-spring-bo...
» Revamp your Testing Knowledge with this 14 Days Free Email Course on Testing Java Applications: https://rieckpil.de/getting-started-w...
#DataJpaTest #InMemoryDatabase #SpringBoot