Summary
I hope I have conveyed to you the importance of testing, not only as a necessary condition for refactoring but also as a cornerstone of quality code. In this chapter, we have understood why testing is crucial and why it is beneficial to do it frequently, allowing us to fail as early as possible – this may appear like a paradox, but it isn’t.
We have various types of tests at our disposal, but we focused particularly on unit testing, for which a framework such as JUnit is of great help.
Since testing is essential, it is crucial to have as much of our code base covered by tests as possible. For this purpose, we have the assistance of another tool, JaCoCo.
Furthermore, we introduced the fundamental methodology TDD, reversing the traditional development flow to start with tests and then proceeding to write the code.
Now that we have covered all the fundamentals, we can move on to the next chapter, where we will finally analyze some refactoring techniques...