Refactor test case