I have some doubts regarding the best approach to perform unit tests in Quarkus.
One option is using mocks, but I have a feeling that using mocks I just "make happy" the test coverage plugins, but on real I don't test anything with this approach.
Another option is using a real database, like embedded H2 database, but for this, I need to put the unit test in order (Insert, Get, Update, Delete), sometimes I'll need the inserted ID from another test to perform a delete operation, for example. There are some complex entities that create some difficulty to insert or delete. So, with this approach, I'll lose the concept of a unit test, because I'll lose the tests interdependency.
Does someone have a suggestion for this scenario? Extra information: I'm using liquidbase, panache entity, junity.
Looks like you're looking for integration tests. I would probably go with the next options:
In case you really want unit tests, in this case 90% of the time you don't need to have the database to test functionality. Because of decoupling you probably have controllers(resources) separate from services. So in case of unit tests I would probably go with:
So it feels like you want to check if your service is doing the job correctly on a higher level, which might not be a unit test, hope the answer will help