Refactoring in tests