some refactoring in tests