Refactor TestSquaredExponentialKernel.

Less code duplication.