🐾 Replay Java: Spring Boot Tips ➡️ @​Autowired ≠ Dependency Injection (DI) [2/2]

CI tests fail with @​Autowired? Fix it:

1️⃣ Integration tests: @​SpringBootTest + @​MockBean

2️⃣ Unit tests: Mockito @​Mock + @​InjectMocks

Long-term: prefer constructor injection ✅

#java #spring #devops #cicd #devtesting

How would you classify a #unittest vs #integrationtest vs #systemtest? Usually, what I do is, setup the test for a class / struct, mock the dependencies and call the methods of struct with test input.

Although there is one #testcase I like to write with mocking just the external services, and using internal code without mocking.

Let me know how you prefer doing #devtesting.