refactoring clear for unit test