public void wrap(final byte[] buffer)
    {
        capacity = buffer.length;
        addressOffset = ARRAY_BASE_OFFSET;
        byteBuffer = null;
        wrapAdjustment = 0;

        if (buffer != byteArray)
        {
            byteArray = buffer;
        }
    }
@Test
    void shouldNotWrapInValidRange()
    {
        final UnsafeBuffer buffer = new UnsafeBuffer(new byte[8]);
        final UnsafeBuffer slice = new UnsafeBuffer();

        assertThrows(IllegalArgumentException.class, () -> slice.wrap(buffer, -1, 0));
        assertThrows(IllegalArgumentException.class, () -> slice.wrap(buffer, 0, -1));
        assertThrows(IllegalArgumentException.class, () -> slice.wrap(buffer, 8, 1));
        assertThrows(IllegalArgumentException.class, () -> slice.wrap(buffer, 7, 3));
    }