Refactors the pagination tests.