Refactoring for unit tests (2).