Refactored tests to be more DRY