
Learn how Java developers use JUnit 5 for unit testing in development, and explore the unit platform, Jupiter engine, vintage compatibility, and Maven with annotations.
Learn to add the JUnit 5 dependency to a Maven project by configuring pom.xml, setting Java 8, and using Maven dependencies to download JUnit Jupiter Engine and related artifacts.
Explore core JUnit 5 annotations, their usage in test methods with @Test, @DisplayName, @BeforeEach, @AfterEach, @BeforeAll, @AfterAll, and @Disabled, and configure Maven with Java 8.
Discover how to use JUnit 5 annotations for conditional test execution, including enabled on OS, enabled on range, and enabled on system properties.
Discover how JUnit 5 uses the order annotation to control test execution, with no fixed starting point, offering alphabetical, random, or custom orders via @testmethodorder and orderannotation.
Discover how to use JUnit 5's @RepeatedTest to execute a test method multiple times by setting a repetition count, with examples showing current and total repetitions.
Learn how JUnit 5 assertions use static methods to compare expected and actual results, and see before each test setup in an employee service example.
Learn to apply JUnit 5 assertions such as assertEquals, assertNull, assertNotNull, assertTrue, assertFalse, assertSame, and iterable equals, including hamcrest and assertThat for collections.
learn to enforce timeouts in JUnit 5 using the timeout annotation, time in seconds, and assertion-based timeout, ensuring tests fail when execution exceeds the limit.
Explore handling expected exceptions in JUnit 5 with assertThrows and doesNotThrow. See practical examples of arithmetic and file not found exceptions using lambda expressions for executable code.
Explore how parameterized tests in JUnit 5 pass inputs to test methods using @ParameterizedTest, combining sources such as @ValueSource, @EnumSource, @MethodSource, @CsvSource, and @CsvFileSource to run multiple scenarios.
Learn to run JUnit 5 unit tests with Maven by configuring pom.xml with Jupiter engine, then execute tests individually or in batches using mvn test and -Dtest options.
Learn how to tag and filter tests in JUnit 5 via Maven, using tag annotations to select tests and run specific classes or methods with Surefire options.
A warm welcome to the JUnit 5 course by Uplatz.
JUnit is a popular unit-testing framework in the Java ecosystem. JUnit 5 added many new features based on the Java 8 version of the language. JUnit 5 is the most widely used testing framework for Java applications. For a very long time, JUnit has been doing its job perfectly.
This JUnit 5 course will help you learn how to understanding why unit tests are important, structure of good unit tests, dynamic and parameterized tests, extensions, code coverage, create and execute unit tests with JUnit 5, and many more topics. This JUnit course focuses on the usage of the framework.
JUnit 5 consists of several different modules:
JUnit Jupiter: JUnit Jupiter includes new programming and extension models for writing tests. It has all new JUnit annotations and TestEngine implementation to run tests written with these annotations.
JUnit Platform: To be able to launch junit tests, IDEs, build tools or plugins need to include and extend platform APIs. It defines the TestEngine API for developing new testing frameworks that runs on the JUnit platform. It also provides a Console Launcher to launch the platform from the command line and build plugins for Gradle and Maven.
JUnit Vintage: It provides support to run JUnit 3 and JUnit 4 written tests on the JUnit 5 platform. It’s there is backward compatibility.
JUnit 5 - Course Syllabus
JUnit Introduction
Adding JUnit5 dependency in Maven project
JUnit5 Annotations
JUnit5 @RepeatedTest Annotation
JUnit5 Assertions
JUnit5 Timeouts
JUnit5 Expected Exceptions
JUnit5 Parameterized Tests
JUnit5 How to run Unit Test with Maven
JUnit5 Tagging and Filtering
Hamcrest Framework
Unit Testing on Spring Boot Repository
Spring Boot Integration Testing