4 ms·
If you use constructor injection services are unit testable without touching Spring.
by oweiler 4y ago
If you use constructor injection services are unit testable without touching Spring.
- mrkeen 4y agoThen can I remove those imports?
- _boffin_ 4y agoMock the dependencies in the constructor and test. Why are you talking about removing imports?
- mrkeen 4y agoI do use constructors. I'm refuting the claim that my unit tests won't touch Spring. If my unit tests don't touch the Spring stuff in my class, either my unit tests on that class are woefully incomplete, or I didn't need the (explicit, directly-coupled) Spring stuff in my class.