Problem:
The Magic Number Test occurs when assert() statements in a test method contain numeric literals (i.e., magic numbers) as parameters.
Solution:
As magic numbers do not indicate the meaning/purpose of the number, they should be replaced with constants or variables, thereby providing a descriptive name for the input.
This is a test refactoring
Problem: The Magic Number Test occurs when assert() statements in a test method contain numeric literals (i.e., magic numbers) as parameters.
Solution: As magic numbers do not indicate the meaning/purpose of the number, they should be replaced with constants or variables, thereby providing a descriptive name for the input.
Before:
Assert.assertEquals(200, response.status);
After:Assert.assertEquals(HTTP_OK, response.status);