public static boolean tryFillGap(
        final UnsafeBuffer logMetaDataBuffer,
        final UnsafeBuffer termBuffer,
        final int termId,
        final int gapOffset,
        final int gapLength)
    {
        int offset = (gapOffset + gapLength) - FRAME_ALIGNMENT;

        while (offset >= gapOffset)
        {
            if (0 != termBuffer.getInt(offset))
            {
                return false;
            }

            offset -= FRAME_ALIGNMENT;
        }

        applyDefaultHeader(logMetaDataBuffer, termBuffer, gapOffset);
        frameType(termBuffer, gapOffset, HDR_TYPE_PAD);
        frameTermOffset(termBuffer, gapOffset);
        frameTermId(termBuffer, gapOffset, termId);
        frameLengthOrdered(termBuffer, gapOffset, gapLength);

        return true;
    }
@Test
    void shouldNotOverwriteExistingFrame()
    {
        final int gapOffset = 0;
        final int gapLength = 64;

        dataFlyweight.frameLength(32);

        assertFalse(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, TERM_ID, gapOffset, gapLength));
    }