Refacter tests to reduce code smell