My classes are following this structure
- Service Tier (creates and maps InputDTO to DB Data)
- DAO Tier (actually executes DB calls)
When I write service tier JUnit tests, the DAO tier is called, and this expects an actual DB connection and getting data from the DB.
Should I be mocking the DAO tier completely from the service tier, or should I be mocking the DB connection and data received from the DB?
Secondly, the app expects certain data from a cache.
For JUnit run time, there is no cache, so how should this be handled? The service tier method includes looking up the cache to get the details.