This method is useful for other tests also. PiperOrigin-RevId: 473574282 (cherry picked from commit f770324f)