Tests for the Counter class
Unlike unit tests that you might have seen from other sources, where you typically only have a single test for a given class, method, or function, in the example of the preceding Counter class, we entered three different unit tests in our test class to test the same functionality.
Recall the point that we made earlier—the test results are only as good as the test themselves, and it is entirely possible for the tests we design to be unable to detect some specific bug that the program to be tested has. Therefore, it is good practice to have multiple test cases for the same functionality that you'd like to test so that we can see whether that functionality is able to handle various different situations and edge cases. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access