Refactored test method