Refactored the unit tests