Slight refactoring in tests