unit tests: refactoring