Getting started

This part of the JUnit 5 course sets up the framework and reads its first report. JUnit 5 is three things at once: the platform that starts a run, Jupiter, the engine that understands @Test, and the console launcher that both of them arrive in. The lessons name the version this image has, put the launcher jar on the class path, and take a class under test and a test class through the two commands that build and run them. The report comes next, read as a tree of containers and tests, then a red test whose assertEquals fails with the expected and the actual value, and the change in the class that turns it green. Every command was run on Java 21 in this container, and every report line is copied from that run.

001 What JUnit 5 is and the launcher jar the platform, Jupiter and the launcher, the version of the image, a first test Open 002 The class under test and the test class one @Test method, the Assertions import, the two javac and junit commands Open 003 Reading the report the suite tree, containers, tests found and failed, the line that changes between runs Open 004 A red test assertEquals fails, the message, the expected and actual values, exit 1 Open 005 Red, fix, green read the failure, change the class, a second test that still fails, the counts Open

Lessons