refactored unit tests