Refactored TestUtil methods.