public static int scan(final UnsafeBuffer termBuffer, final int termOffset, final int limitOffset)
    {
        int offset = termOffset;

        while (offset < limitOffset)
        {
            final int frameLength = frameLengthVolatile(termBuffer, offset);
            if (frameLength <= 0)
            {
                break;
            }

            final int alignedFrameLength = align(frameLength, FRAME_ALIGNMENT);

            if (isPaddingFrame(termBuffer, offset))
            {
                if (termOffset == offset)
                {
                    offset += alignedFrameLength;
                }

                break;
            }

            if (offset + alignedFrameLength > limitOffset)
            {
                break;
            }

            offset += alignedFrameLength;
        }

        return offset;
    }
@Test
    void shouldScanEmptyBuffer()
    {
        final int offset = 0;
        final int limit = termBuffer.capacity();

        final int newOffset = TermBlockScanner.scan(termBuffer, offset, limit);
        assertEquals(offset, newOffset);
    }