Some refactoring of tests.