Test data and files
Tests that need data and a disk. @TempDir gives every test a folder of its own, as a field or as a parameter, and removes it afterwards; the next lesson writes, reads, compares and deletes a file in that folder, a missing file included. A text format is then tested for real: a CSV writer whose lines are compared as lines, and a comma inside a value that breaks a naive split. The in-memory repository follows, a Map behind an interface with add, find, remove and the duplicate rule, and the part closes with test doubles: a hand-written fake and a stub, and the reason Mockito is not run in this image.
026
A fresh folder for every test
@TempDir as a field and as a parameter
Open
027
Files in a test
write, read, compare and delete, a missing file
Open
028
Testing a text format
a CSV writer, the lines compared, a comma in a value
Open
029
An in-memory repository
a Map behind an interface, add, find, remove, the duplicate rule
Open
030
Test doubles without Mockito
a hand-written fake and a stub, why Mockito is not run here
Open