This function is only used in unittests.