At this time, we know how TDD works—writing tests before, implementation after tests, and refactoring later on. We are going to pass through the process and only show the final result for each requirement. It is left to you to figure out the iterative Red-Green-Refactor process. Let's make this more interesting, if possible, by using a Hamcrest framework in our tests.
The TDD or test-first implementation
Hamcrest
As described in Chapter 2, Tools, Frameworks, and Environment, Hamcrest improves our test's readability. It makes assertions more semantic and comprehensive when complexity is reduced by using matchers. When a test fails, the error shown becomes more expressive by interpreting the matchers used in...