Refactoring some unit test case.