JUnit 5 in practice

Five lessons that put the parts together. A calculator is taken end to end: the class, one test per operation, a failing case, the fix and the whole report. A generic stack comes next, with push, pop and the exception of an empty stack, and a parameterised test that runs the same cases over two types. Text and Unicode follow, where a line ending and an invisible character make an assertion fail for a reason the reader cannot see. A service and its fake show a test that runs without the slow implementation and counts the calls it made. The capstone is a task tracker: a model, a store, a service, a parameterised test, an exception test and one red run that is read and fixed.

036 A calculator end to end the class, its tests, one failing case, the fix, the whole report Open 037 A generic stack push, pop, the empty-stack exception, a parameterised test over types Open 038 Text, Unicode and regular expressions a line ending, an invisible character, assertEquals on a regex match Open 039 A service and its fake an interface, a slow implementation, a fake that counts calls, tests without the real one Open 040 Capstone: a task tracker the model, the store, the service, a parameterised test, an exception test, one red run fixed Open

Lessons