Code that grows over time without refactoring can get quite messy and hard to test. The same applies for to test code, and curiously, they often appear together. Not always is it possible to fix the design problems first, creating a need to write clean tests for hard to test code.
In this workshop, participants will learn some techniques to clean up messy JUnit tests to make them more readable and easier to change.
After a short introduction and an example refactoring, participants will work in pairs to refactor some example unit tests and learn how to write better ones from scratch.
- create complex objects easily with the builder pattern
- use hamcrest matchers to improve your assertions
- discover the power of JUnit rules