Refactor tests to use generation instead of copy/paste