Test Smell: Unnecessary Test Code
Explore how to refine your JUnit tests by identifying and removing unnecessary test code. Learn to handle exceptions properly without clutter, and eliminate redundant assertions like not-null checks to improve test clarity and maintainability.
We'll cover the following...
We'll cover the following...
Expect the exceptions
The test code that comprises testSearch() doesn’t expect any exceptions to be thrown. It contains a number of assertions against positive facts. If the test code throws an ...