JUnit Jupiter Tutorials.
JUnit 5 quick start tutorial.
Understanding JUnit 5 life cycle methods
Understanding assertions methods in Assertion class
Asserting equality
Assertions#assertSame() examples
Assertions#assertInstanceOf() example()
assertTrue/assertFalse examples
assertNull/assertNotNull examples
Asserting Array And Iterable Equality
Assertions#assertLinesMatch() examples
Assertions#assertAll() examples
Asserting exception examples
Timeout Assertions
Assertions#fail() example
Use of @Nullable in Assertion class
Understanding Assumptions
JUnit 5 Assumptions: assumeTrue and assumeFalse examples and usage.
JUnit 5 Assumptions: using assumingThat to run a block conditionally without aborting the whole test.
JUnit 5 Assumptions: aborting a test manually with Assumptions.abort(...); also shows throwAssumptionFailed(...)
JUnit 5 @DisplayName: give readable names to test classes and methods for reports and IDEs.
JUnit 5 DisplayNameGenerator: control how display names are generated for test classes and methods using built-in generators or a custom one.
Configure a global JUnit 5 DisplayNameGenerator using junit-platform.properties so all tests get readable names without annotating each class.
Implement a custom JUnit 5 DisplayNameGenerator to produce readable test names, and see how it interacts with @DisplayName and nested tests.
Use JUnit 5 @Disabled to skip tests temporarily at class or method level, with optional reasons.
Use @EnabledIfSystemProperty and @DisabledIfSystemProperty to run or skip tests based on JVM system properties.
Use @EnabledIfEnvironmentVariable and @DisabledIfEnvironmentVariable to run or skip tests depending on environment variables.
Use JUnit 5 @EnabledIf and @DisabledIf to conditionally run or skip tests based on boolean-returning methods.
Use @EnabledOnJre/@DisabledOnJre and range annotations to control test execution by Java runtime version.
Use @EnabledOnOs and @DisabledOnOs to conditionally run tests on Windows, Linux, macOS, and others.
Introduction to parameterized tests in JUnit Jupiter using @ParameterizedTest. Conceptual overview and Javadoc reference.
Using @ValueSource to supply arguments to parameterized tests in JUnit 5.
Using @CsvSource to supply multiple arguments to a parameterized test in JUnit 5.
Using @MethodSource to supply arguments from factory methods to parameterized tests in JUnit 5.
Using @CsvFileSource to read test data from CSV files in JUnit 5.
Using @EnumSource to provide enum constants to parameterized tests in JUnit 5.
Using a custom ArgumentsProvider via @ArgumentsSource to feed arguments to parameterized tests in JUnit 5.
Using SimpleArgumentConverter with @ConvertWith to convert input values in parameterized tests (JUnit 5).
Combine multiple sources for parameterized tests in JUnit 5.
Using @ParameterizedTest with @NullSource to provide a single null argument to parameterized tests in JUnit 5.
Using @EmptySource to provide empty values (like empty strings) to parameterized tests in JUnit 5.
Using @NullAndEmptySource to combine null and empty values for parameterized tests in JUnit 5.
Learn how to use the Named interface in JUnit 5 to provide custom display names for parameterized test arguments.
Demonstrating how a JUnit test class can extend a superclass to reuse tests.
Demonstrating how a JUnit test class can implement an interface with default tests.
Understanding the @TestInstance annotation and test lifecycle in JUnit 5.
Using @TestInstance default PER_METHOD lifecycle in JUnit 5.
Using @TestInstance(PER_CLASS) to share test instance across methods.
Comparing PER_METHOD and PER_CLASS lifecycles with practical examples.
Introduction to @Nested tests in JUnit 5 for organizing test classes.
Understanding @BeforeAll, @AfterAll, @BeforeEach, and @AfterEach in nested test classes.
How nested test classes inherit and share state from outer classes to avoid test setup duplication.
Customizing display names for nested test classes using @DisplayName annotation.
Combining @Nested classes with @ParameterizedTest for data-driven testing in hierarchical structures.
Implementing Given-When-Then / BDD pattern using JUnit 5 nested test classes.
Understanding the @Tag annotation in JUnit 5 for categorizing and filtering tests.
Basic usage of @Tag annotation on method in JUnit 5.
Class-Level Tagging with JUnit's @Tag
Filtering tests by tags using Maven Surefire Plugin configuration in JUnit 5.
Using @Tag on @Nested classes to tag entire groups of related tests at once.
Creating custom composed annotations for consistent tagging patterns in JUnit 5.
Programmatic filtering of JUnit 5 tests using JUnit Platform Launcher API with custom filtering logic.
Introduction to JUnit Platform Suite Engine for composing and executing custom test suites in JUnit 5.
Using @SelectPackages to include all tests from specific packages in a JUnit 5 test suite.
Using @IncludePackages to filter and include specific packages within selected packages in JUnit 5 test suites.
Using @ExcludePackages to filter and exclude specific packages from selected packages in JUnit 5 test suites.
Using @SelectClasses to include specific test classes in a JUnit 5 test suite.
Using @IncludeClassNamePatterns to filter test classes by name patterns in JUnit 5 test suites.
Using @ExcludeClassNamePatterns to filter out test classes by name patterns in JUnit 5 test suites.
Combining multiple filters like @IncludeTags, @ExcludeTags in JUnit 5 test suites.
Demonstrates suite-level lifecycle callbacks using @BeforeSuite and @AfterSuite in JUnit 5/6.
Composing hierarchical and nested test suites using the JUnit Platform Suite Engine.
Demonstrating how a JUnit @Suite class can be extended to reuse configuration like @SelectPackages and override filters with @Tag.
Demonstrating how a JUnit @Suite configuration defined in an interface can be reused and filtered in implementing classes.
Minimal custom TestEngine example demonstrating @IncludeEngines and @ExcludeEngines in JUnit.
Understanding test execution order, ordering annotations, and interfaces in JUnit 5.
Using MethodOrderer.MethodName to order test methods alphabetically by method name in JUnit 5.
Using MethodOrderer.DisplayName to order test methods alphabetically by display name in JUnit 5.
Using MethodOrderer.OrderAnnotation with @Order to specify explicit numerical ordering of test methods in JUnit 5.
Using MethodOrderer.Random for non-deterministic test execution order in JUnit 5.
Using @TestClassOrder with ClassOrderer.ClassName to order nested test classes alphabetically by class name
Setting default method and class orderers globally using JUnit configuration parameters.
Creating custom MethodOrderer implementations for specialized test method ordering in JUnit 5.
Creating custom ClassOrderer implementations for specialized test class ordering in JUnit 5.
Introduction to Repeated Tests by using @RepeatedTest
Basic usage of @RepeatedTest in JUnit 5 to run the same test multiple times.
Using RepetitionInfo with @RepeatedTest to access repetition metadata in JUnit 5.
@RepeatedTest#getFailureCount() Example
Controlling early termination of repeated tests using failureThreshold in JUnit 5.
Understanding the difference between @RepeatedTest failureThreshold and RepetitionInfo#getFailureThreshold in JUnit 5 and 6.
Using custom display name patterns with @RepeatedTest in JUnit 5.
Understanding lifecycle callbacks with @RepeatedTest in JUnit 5.
Introduction to dynamic tests in JUnit 5 using @TestFactory.
Using Java Streams to generate dynamic tests in JUnit 5.
Data Driven Dynamic Testing in JUnit 5.
Dynamic Tests Lifecycle Limitations in JUnit 5.
Using the Named interface to provide custom display names for dynamic tests in JUnit 5.
Exploring overloaded factory methods in JUnit 5 DynamicTest for advanced test generation.
Using NamedExecutable to simplify dynamic test creation in JUnit 5.
Learn how to create nested test structures using DynamicContainer and DynamicNode in JUnit 5.
Learn the basics of JUnit 5 Jupiter Extension model and how to use @ExtendWith with ParameterResolver.
Introduction to JUnit Jupiter Extension model and the available extension point interfaces.
Practical examples of BeforeAll, BeforeEach, BeforeTestExecution, AfterTestExecution, AfterEach, and AfterAll callbacks in JUnit 5.
Learn how to use ExecutionCondition to programmatically enable or disable JUnit 5 tests.
Using ParameterResolver to inject custom objects into JUnit 5 test methods.
Learn how to use TestInstanceFactory in JUnit 5 to manually create test instances with custom constructors.
Learn how to use TestInstancePostProcessor in JUnit 5 for field injection and post-instantiation setup.
Learn how to use TestInstancePreDestroyCallback in JUnit 5 to perform cleanup logic before a test instance is destroyed.
Learn how to use InvocationInterceptor in JUnit 5 to wrap and control the invocation of test methods, including retry logic.
Learn how to use TestExecutionExceptionHandler in JUnit 5 to intercept and handle exceptions thrown during test execution.
Learn how to use LifecycleMethodExecutionExceptionHandler in JUnit 5 to handle or swallow exceptions in @BeforeEach, @AfterEach, @BeforeAll, or @AfterAll methods.
Learn how to use TestWatcher in JUnit 5 to monitor and process test results like success, failure, and abortion.