Our application has a service layer and a DAO layer written as Spring beans.
When testing the level of service, I don’t want to depend on the real database, so I mock that by creating a “Mock” Impl for the DAO layer
Therefore, when I test the service level, I associate the beans service level with Mock DAO beans A in Production - binds the service layer to the "real" DAO beans
Is that a good idea? Any alternative suggestion on how to mock a database tier?
Clarification: This question is about testing the level of service, not the DAO level. When testing the level of service, I assume that either the DAO layer has already been tested or does not need to be tested. The main thing is how we test the service level, regardless of the DAO implementation, so I mock the DAO level
source
share