This is an example for working with legacy code that I use in teaching.

The original code is the one that Brett Schuchert has used in talks about working with legacy code.

Git branches

  • master The legacy code we start out with.
  • golden_master Now we have an integration test and a pseudo-unit test that uses black magic from JMockit.
  • solution is not complete, but a significant step forward.
    • Class for currency symbols extracted.
    • Extracted caching to decorator pattern using TDD.

Working with the code

Run all tests with ./gradlew (*nix) or gradlew.bat (Windows)

Create project files with ./gradlew eclipse or ./gradlew idea

Credits

Thanks to Brett Schuchert for this prolific example – and for generally publishing everything on his wiki under the Creative Commons Attribution-ShareAlike license.

License

This material is published under the same CC BY-SA 2.5 license as Brett’s talk.