setFileExtension method and tests