...

/

Test Smell: Bloated Construction

Test Smell: Bloated Construction

Learn how to prevent bloated construction in your tests.

The constructor should only satisfy the necessary object’s preconditions. When a lot of code has to be executed to get the things instantiated, though, it becomes bloated and is called a bloated constructor.

We must pass an InputStream to a Search object through its constructor. Our test builds an InputStream in two places. The first construction ...

Access this course and 1400+ top-rated courses and projects.