Everyone should have a tool-building factory factory factory

fuck_u_spez@lemmy.fmhy.ml to Programmer Humor@programming.dev – 560 points –
59

You are viewing a single comment

How do you write tests?

How does dependency injection have anything to do with writing tests? I write tests by writing a test function that executes the code I want to test...

I mean unit tests. I work on Spring Boot apps where there are distinct layers (controller -> service -> persistence), and you generally inject mocks into your object to isolate tests to the specific code you want under test. One benefit of this approach is that it's pretty easy to get 90% coverage.