refactored tests and code of ship class