I'm trying to figure out what is the best approch to unittesting in SpringBoot app. Before last friday i thought that best approach is to test:
- controllers with mockmvc and mocked services
- services with mocked repositories
- repositories with mocked db
- using
SpringBootTestmainly for integration tests.
But then i watched this -Ian Cooper - TDD, Where Did It All Go Wrong and I've realized that my testswas implementation tests, and I should only mock db, filesystem, other systems, not my application.
And I'am wondering how should I be doing this? Because when I will be creating all objects myself it will still be "testing implementation", so I can use SpringBootTest with MockBean but this would be extremly slow.
Can someone clever than me could share his experience or thougths on this?