refactored testcase and fixed it