refactoring test helper and test