testing codeclimate by refactoring a duplicate method