private MergeSortedPages() {}
@Test
    public void testSortingYields()
            throws Exception
    {
        DriverYieldSignal yieldSignal = new DriverYieldSignal();
        yieldSignal.forceYieldForTesting();

        List<Type> types = ImmutableList.of(INTEGER);
        WorkProcessor<Page> mergedPages = MergeSortedPages.mergeSortedPages(
                ImmutableList.of(WorkProcessor.fromIterable(rowPagesBuilder(types)
                        .row(1)
                        .build())),
                new SimplePageWithPositionComparator(types, ImmutableList.of(0), ImmutableList.of(DESC_NULLS_LAST)),
                ImmutableList.of(0),
                types,
                (pageBuilder, pageWithPosition) -> pageBuilder.isFull(),
                false,
                newSimpleAggregatedMemoryContext().newAggregatedMemoryContext(),
                yieldSignal);

        // yield signal is on
        assertFalse(mergedPages.process());
        yieldSignal.resetYieldForTesting();

        // page is produced
        assertTrue(mergedPages.process());
        assertFalse(mergedPages.isFinished());

        Page page = mergedPages.getResult();
        MaterializedResult expected = resultBuilder(TEST_SESSION, types)
                .row(1)
                .build();
        assertEquals(toMaterializedResult(TEST_SESSION, types, ImmutableList.of(page)), expected);

        // merge source finished
        assertTrue(mergedPages.process());
        assertTrue(mergedPages.isFinished());
    }