refactoring test with yield