refactored the test case