Refactored unit tests