Problem:
Conditions within the test method will alter the behavior of the test and its expected output, leading to situations where the test fails to detect defects in the production method since test statements were not executed as a condition was not met.
Solution:
Instead of using a conditional to control the test execution, we use the proper JUnit API with assumeNotNull(). If the initial assumption is not met, the test will be ignored instead of passed without actually testing the code under test.
This is a test refactoring.
Problem: Conditions within the test method will alter the behavior of the test and its expected output, leading to situations where the test fails to detect defects in the production method since test statements were not executed as a condition was not met.
Solution: Instead of using a conditional to control the test execution, we use the proper JUnit API with assumeNotNull(). If the initial assumption is not met, the test will be ignored instead of passed without actually testing the code under test.
Result: Before:
if(KBucketEntry.crc32c == null) return;
AfterassumeNotNull(KBucketEntry.crc32c);