Well, incredible 😂 Now I realize the possibility of using the @InjectMocks annotation. I'll have to take a second look at some of my other testing classes and replace things. Fool me. Thank you again @NyorJa !!
Whenever a class about to be tested, that depends on beans, is instantiated by traditional new X(), said constructor call can instead be replaced by adding an @InjectMocks annotation to the field the class is instantiated to.
Originally posted by @bglamadrid in https://github.com/trebol-ecommerce/spring-boot-backend/pull/111#pullrequestreview-1132336361
Description
Whenever a class about to be tested, that depends on beans, is instantiated by traditional
new X()
, said constructor call can instead be replaced by adding an@InjectMocks
annotation to the field the class is instantiated to.