Refactored duplication from the tests