Remove duplication in tests.