Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tip

Tests are a great way of identifying code smells. Highly coupled code leads to untestable code.

You want to test one class and one class only. The previous version of the TopicManager dragged in HighestNumberFinder. So inadvertently you were testing that class as well. This will become clearer as we continue to work through the TopicManager tests.

QL-4.2) Working with Stubs

Info

A Stub is part of the family of Test Doubles. They are used to ensure that tests focus on the behaviour of the CUT and not its dependents. Test environments should be controlled and predictable. Test Doubles give you that measure of stability and predictability.

A Stub method is one that returns canned results. A canned result is a predefined result. The result can be specific, a range of values, or any value. Also, the parameters into the method can be specific value, a range of values, or any value.

...

Info

We’ve now created a controlled environment for our tests

QL-4.

...

3 Stubs, complete the last two TopicManager requirements

Add more tests to handle the last two requirements

...