Re:You do not need inheritance with OOP
by oweiler on Wednesday November 09, 2022 @06:09AM
(#33529823)
If you use constructor injection services are unit testable without touching Spring.
[ Parent
| on HN ]
Re:You do not need inheritance with OOP
by mrkeen on Wednesday November 09, 2022 @06:47AM
(#33530207)
Then can I remove those imports?
Re:You do not need inheritance with OOP
by _boffin_ on Wednesday November 09, 2022 @10:42AM
(#33533176)
Mock the dependencies in the constructor and test.
Why are you talking about removing imports?
Re:You do not need inheritance with OOP
by mrkeen on Thursday November 10, 2022 @01:00PM
(#33550508)
I 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.