How are you testing with your database?
So what is the solution? There are some very neat solutions for running embedded datastores based on containers, namely the Docker-Maven-Plugin and Testcontainers. From your tests you can start a lightweight, throwaway instance of your datastore and this talk will walk you through three different approaches and how to make them work for your tests.
Demoing multiple approaches of integration tests with Elasticsearch.