Code deduplication in tests.