refactored unittest