refactor unit testcase