Tagged “Testing”
4 articles with this tag.
- Dependency InjectionWhat dependency injection is, why constructor injection is the default, how a composition root works in plain Java, and what the Spring container automates — with a runnable before-and-after example and interview questions.
- Spring Boot ImplementationA complete, tested order-management service in Spring Boot 4 and Java 21, built with ports and adapters: package structure, domain model, use cases, REST and JPA adapters, wiring, and tests that run without Spring or a database.
- Integration testingTesting Spring applications with real infrastructure: @SpringBootTest and web environments, test slices (@WebMvcTest, @DataJpaTest, @JsonTest, @RestClientTest), MockMvc and RestTestClient/WebTestClient, @MockitoBean, Testcontainers with @ServiceConnection, reusable containers and dev-time services, context caching, contract tests, and a practical test strategy.
- Unit testing (JUnit, Mockito)Fast, focused tests for Java and Spring code: the testing pyramid, JUnit Jupiter (JUnit 5 and 6) lifecycle, assertions with AssertJ, parameterized and nested tests, Mockito mocks, stubs, spies, verification and argument captors, BDD style, testing without Spring, test doubles vs fakes, and what makes a good unit test.