public static void insert(
        final UnsafeBuffer termBuffer, final int termOffset, final UnsafeBuffer packet, final int length)
    {
        if (0 == termBuffer.getInt(termOffset))
        {
            termBuffer.putBytes(termOffset + HEADER_LENGTH, packet, HEADER_LENGTH, length - HEADER_LENGTH);

            termBuffer.putLong(termOffset + 24, packet.getLong(24));
            termBuffer.putLong(termOffset + 16, packet.getLong(16));
            termBuffer.putLong(termOffset + 8, packet.getLong(8));

            termBuffer.putLongOrdered(termOffset, packet.getLong(0));
        }
    }
@Test
    void shouldFillAfterAGap()
    {
        final int frameLength = 50;
        final int alignedFrameLength = BitUtil.align(frameLength, FRAME_ALIGNMENT);
        final int srcOffset = 0;
        final UnsafeBuffer packet = new UnsafeBuffer(ByteBuffer.allocate(alignedFrameLength));
        final int termOffset = alignedFrameLength * 2;

        TermRebuilder.insert(termBuffer, termOffset, packet, alignedFrameLength);

        verify(termBuffer).putBytes(
            (alignedFrameLength * 2) + HEADER_LENGTH,
            packet,
            srcOffset + HEADER_LENGTH,
            alignedFrameLength - HEADER_LENGTH);
    }