refactor unit test