Some test code de-duplication