Nick

25%
Flag icon
Perhaps a better rule is that we want to test a single concept in each test function. We don’t want long test functions that go testing one miscellaneous thing after another. Listing 9-8 is an example of such a test. This test should be split up into three independent tests because it tests three independent things. Merging them all together into the same function forces the reader to figure out why each section is there and what is being tested by that section. Listing 9-8    /**    * Miscellaneous tests for the addMonths() method.    */    public void testAddMonths() {        SerialDate d1 = ...more
This highlight has been truncated due to consecutive passage length restrictions.
The Robert C. Martin Clean Code Collection (Collection) (Robert C. Martin Series)
Rate this book
Clear rating
Open Preview