English
Topic 12. Working with files, data serialization with kotlinx.serialization, and unit testing
Goal: learn to define a file format, validate external data, serialize models, and prove the behavior of storage with isolated unit tests.
Lecture contents
- Files, text, and bytes — The path and the working directory · Text, bytes, and closing resources · Example 1. An event log
- Safe writing and CSV format — I/O errors and safe replacement · CSV: a format has a contract
- JSON serialization — Adding kotlinx.serialization and tests · JSON and serializable models · Dates and a custom serializer
- Unit testing — A unit test as an executable contract · Running, reports, and coverage