Only used in unittests.