Refactor of test case