Starts with a unit-testing styles and then describing some interesting parts of mockito.
You need to know what you test:
- Verify State:
- Verify Behaviour:
Different mocking components:
- Dummy Objects
- Not actually of any production use, but can fill up parameters.
- Fake Objects:
- Canned answers:
XUnit Test Patterns - Gerard M
Legacy code: Capture what the legacy system produces as a result and use that as expected in a unit test.
- To verify that I do not break anything
- To learn about the legacy code.
- To see changes.
Working effectively with Legacy Code: Michael Ferris
The talks ends with interesting discussions and questions:
Better to write code that can be tested than code that is private.
To change code you have to have tests.