Note
This repository is archived and no longer maintained. The workshop was presented at conferences, but is unlikely to be presented again. Feel free to browse the material or work through it on your own; just expect dependency versions to drift out of date.
A hands-on workshop on adopting better testing practices in Java, using OpenRewrite to automate the migrations.
The workshop site walks through seven sections:
- Bad habits: common but outdated testing patterns, and ways to improve them.
- Old habits: legacy frameworks such as JUnit 3 & 4, Hamcrest and older Spring MockMvc usage.
- JUnit Jupiter: migrating to JUnit 5 and 6, with parameterized and nested tests.
- Adopt AssertJ: more expressive, type-specific assertions.
- Advanced AssertJ: soft assertions, recursive comparison, extracting and custom assertions.
- Upgrade your projects: applying best practices and rolling out upgrades in real-world projects.
- Recipe development: writing your own OpenRewrite recipe.
The repository layout:
site/: the Docusaurus source for the workshop site.books/: example tests showing each habit, from plainassertand JUnit 3 through to AssertJ.orders/: a small order domain whose tests serve as hands-on exercises for the JUnit and AssertJ sections.recipes/: the custom recipe built in the recipe development section.rewrite.yml: declarative recipes composed during the workshop, to adopt AssertJ and Java 21 in tests.