Refactoring in test to improve maintainability