Summary

This chapter explained the unit testing strategy for the legacy code and new development. It covered the legacy code issues, refactored the legacy code, illustrated design for testability, described the TDD concepts and TDD life cycle, demonstrated TDD examples, and refactoring.

Now the reader should be able to write unit tests for legacy code, refactor the legacy code to improve the design of the existing code, and start writing simple, clean, and maintainable code that follows TDD, and refactor the code to improve its quality.

The next chapter covers the best practices of unit testing.

Get Mastering Unit Testing Using Mockito and JUnit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.