Testing in Java
5 Topics
1
JUnit 5 Fundamentals
Master the structure, lifecycle, and assertions of the modern Java testing framework.
Essential for standard unit testing questions. Expect discussions on test lifecycles (PER_METHOD vs PER_CLASS), nested and parameterized tests, and exception assertion syntax.
2
Mocking with Mockito
Learn how to isolate your unit tests from heavy dependencies using mock objects and verification steps.
Highly relevant for software engineer positions. Expect questions on Mocks vs Spies, argument capturing, stubbing void methods, and avoiding over-mocking.
3
Integration Testing with Testcontainers
Run real, disposable Docker instances of databases and message queues during integration tests.
Highly relevant for senior developers. Focuses on lifecycle management, port mapping dynamically, and overriding Spring property sources.
4
Testing Best Practices
Write clean, maintainable, fast, and deterministic tests following the F.I.R.S.T principles.
Frequently asked to rate testing maturity. Topics include test naming, assertion patterns, mocking boundaries, and handling concurrency.
5
Code Coverage with JaCoCo
Understand instruction, branch, and line coverage using the JaCoCo agent parser.
Tests understanding of execution metrics. Expect discussions on branch coverage vs line coverage, and how code coverage can mislead teams.