Some unit test refactoring