
Mockito JUnit 5 Extension Setup With MockitoExtension
Set up Mockito with JUnit 5 using MockitoExtension, Mock, InjectMocks and Captor, choose strictness, and avoid manual MockitoAnnotations.openMocks calls.
Assertions, parameterized tests, extensions and lifecycle in JUnit 5, for tests you can read six months later.

Set up Mockito with JUnit 5 using MockitoExtension, Mock, InjectMocks and Captor, choose strictness, and avoid manual MockitoAnnotations.openMocks calls.

Add JaCoCo to a Maven project to measure line and branch coverage from JUnit, produce HTML and XML reports, and enforce a minimum in the build.

Learn AssertJ: fluent assertions for values, strings, collections, exceptions and objects, soft assertions, custom messages and extracting fields.

Test exceptions, log output and System.out in JUnit 5: assertThrows, checking messages and causes, capturing logs with Logback appenders and console output.

Migrate JUnit 4 rules to JUnit 5 extensions: TemporaryFolder to TempDir, ExpectedException to assertThrows and custom rules to callbacks.

How JUnit creates a new test instance per method by default, when PER_CLASS changes it and what that means for shared state and parallel runs.

Write property based tests with jqwik: generators, shrinking, custom arbitraries for domain objects, round trip properties and seeds.

Feed multi parameter tests in JUnit with MethodSource, CsvSource, CsvFileSource and ArgumentsSource, and choose the one that keeps test data readable.

Fix Mockito errors about final classes, records and static methods by using the inline mock maker, and decide when a final class should be an interface.

Generate tests at runtime in JUnit with TestFactory, DynamicTest and DynamicContainer, and learn how they differ from parameterized tests.

A Mockito tutorial: create mocks, stub return values and exceptions, verify calls and arguments, and know where mocks help a test and where they hurt.

Use JUnit Nested classes to group tests by state or behaviour, share setup with scoped BeforeEach, and keep large test classes readable.
We send one email when a new post is published. No spam.