Minor refactoring in tests.