move common unit test code