trebol-ecommerce / trebol-backend-monolith

Monolithic eCommerce backend web application that exposes a RESTful API.
MIT License
16 stars 21 forks source link

test: reduce target class instantiation boilerplate using `@InjectMocks` #113

Closed bglamadrid closed 2 years ago

bglamadrid commented 2 years ago

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 !!

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.

NyorJa commented 2 years ago

hi @bglamadrid please assign me this to me. thanks