Fix some tests by isolating the setup block into a helper class.