Refactor synchronization test code to avoid compiler warning