Chapter 7

Inheritance and Polymorphism

Java is an object-oriented language, as we know. In addition to object identity and data encapsulation, inheritance and polymorphism are other important concepts of the object-oriented paradigm.1 These two concepts have not played a major role in the previous chapters of this book, except in the implementation of our test cases. As useful and convenient as inheritance and polymorphism may be for software development, the problems they can cause during testing can be equally big. But all complaints are useless: we have to deal with the positive and negative effects.

7.1 Inheritance

Well-Shaped Inheritance Hierarchies

Many inexperienced developers consider inheritance between classes mainly as a practical ...

Get Unit Testing in Java 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.