https://reflectoring.io/spring-boot-data-jpa-test/
Read this if you want to have a great overview of Spring Data, unit testing the Persistence Code
Spring Data queries:
– inferred queries
– a custom JPQL query
– Another way is to use a native query