Refactored unit test