Gravitation inside spherical hole in universe I was doing a little thought experiment and ran into a paradox. How to compute the gravitational field inside a spherical hole in a universe that is otherwise filled with uniformly distributed mass?
If we start with just a spherical shell of mass in an otherwise empty universe, then it is well-known that inside the shell, there is zero gravitation, independent of the thickness of the shell. If we then subsequently keep the inside of the shell the same size, but make the shell thicker and thicker, we should be able to make it fill the whole universe (assuming it is a spherically curved universe). By that reasoning, there should not be any gravitation inside a spherical hole inside a universe of equally distributed mass. So a small test mass near the border of the hole should not feel any gravitational force. 
Now we subsequently fill the hole with a sphere of mass. The small test mass near the border of the hole should feel gravitation from this sphere of mass, that is just normal gravitation laws for spherical masses. If the test mass feels gravitation from the sphere, but not from the rest of the universe, then there should be a net gravitational force on it. 
But if the hole is filled with a spherical mass of the same mass density as the rest of the universe, then effectively, there is no hole, and we just have a universe filled with uniformly distributed mass. In such a universe, the test mass should not feel any gravitation where ever it is placed.
Where does my reasoning go wrong, and how can the gravitation inside a spherical hole be calculated?
 A: You don't even need a shell, I think this is a simpler description of your problem:
Consider a sphere with radius R, constant mass density $\rho$ inside and zero mass density outside. The gravitational force inside the sphere at a distance r from the center is
$$F=r\frac{GmM}{R^3}=rGm\frac{4}{3}\pi\rho \quad\text{for}\quad r<R.$$
If we now let R go to infinity, then we have a universe filled with uniform mass density, yet the force is not zero everywhere.

In such a universe, the test mass should not feel any gravitation where
  ever it is placed.

I think this is where your reasoning goes wrong. If we start with a cube instead of a sphere and let the borders go to infinity, then we will also get a universe with infinite uniform mass density, but $F$ will look completely different. This is because by choosing such a shape, we define different boundary conditions.
There is a good analogy given by knzhou in this thread.

Here's an analogous question: suppose a function $f$ obeys $f''(x)=1$ and
  we want to solve for $f(x)$. Since every point on the real line is the
  same as every other point, we might think that by symmetry,
  $f(x)=\text{constant}$. But this is completely wrong, because the
  second derivative of a constant is zero. And stepping back, the whole
  question doesn't make any sense, because there isn't enough
  information. To solve a general differential equation, you need
  boundary conditions.

A: You should sum up contribution of shells centered at the test particle, not at the center of the cavity. The shell theorem is not applicable in this case.
Let's consider a simpler 1D case.

Suppose a rope pulling (tug of war) game with infinite number of players in the both teams with a test particle at zero.
All players produce the same pull and are located at all integer distances from zero, but at zero itself and at $1$ the players are missing.
Which team will win? Here we step into the area of divergent series and integrals. The cardinalities of the sets {-1,-2,-3,...} and {2,3,4,...} are the same, but they have different numerocities. By definition, numerocity is the sum of the indicator function over the set: $\sum_{k=-\infty}^\infty p(k)$, where $p(k)$ is $1$ if $k$ is in the set and $0$ otherwise.
So, the numerocity of the left team is $\sum_{k=-\infty}^{-1} 1$ while the numerocity of the right team is $\sum_{k=2}^\infty 1$. The both sums are divergent, but their regularized values are different.
The regularized value of the left-hand sum is $-1/2$ while the regularized value of the right-hand sum is $-3/2$.
They also can be expressed with integrals as $\int_{-\infty}^{-1/2}dx$ and $\int_{3/2}^\infty dx$.
If the infinite parts cancel each other, the finite parts give victory to the left-hand-side team.
In a more complicated 3D case one should account for situations, where the infinite parts may not cancel each other (this is not the case of your original question, but may arise if at the sides of a test particle are  infinite cones, cylinders, paraboloids, sponges or other infinite shapes, which need to be compared).
Due to Fourier or Laplace transform we can formally denote the divergent integral $\int_0^\infty dx$ as $\pi\delta(0)$ or, for simplicity, $\tau$.
This way, the strength of the left-hand team in our example is $\int_{-\infty}^{-1/2}=\tau-1/2$ and the strength of the right-hand team is $\int_{2/2}^\infty=\tau-3/2$
The integrals of monomials, needed in multi-dimensional complicated cases will follow the following law:
$\int_0^\infty x^n dx=\frac{\left(\tau +\frac{1}{2}\right)^{n+2}-\left(\tau -\frac{1}{2}\right)^{n+2}}{(n+1)(n+2)}$
For more information on divergent integrals, see here (need MathML-capable browser (Firefox, PaleMoon).
