Minor refactoring of test code.