I have a service, which fetches complicated JPAQueries. I have to write h2 database tests for this service. The autowired service in this "fetching" service builds the JPAQueries. So I have to mock this autowired service and I have to return the builtQuery for the fetching service. I made a tutorial from Baeldung for this, and this says I have to use the TestEntityManager. Now I want to build the JPAQuery for returning of the QueryBuilderService which is mocked. When I made
new JPAQuery(entityManager)
It wants the EntityManager as param and not the TestEntityManager.
Do anybody have a good solution for this? Exists something like "TestJPAQuery" or something? Please help :)
Aucun commentaire:
Enregistrer un commentaire