-
-
Save jacques-n/737c26b7016ed29dc710d4aba617340e to your computer and use it in GitHub Desktop.
Example failure of slice boundary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.assertEquals; | |
import org.apache.arrow.memory.BufferAllocator; | |
import org.apache.arrow.memory.RootAllocator; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.junit.rules.ExpectedException; | |
import io.netty.buffer.ArrowBuf; | |
public class TestSliceBoundary { | |
@Rule | |
public ExpectedException thrown = ExpectedException.none(); | |
@Test | |
public void ensureOversizedSliceFail() { | |
try (BufferAllocator allocator = new RootAllocator(128); | |
ArrowBuf buf = allocator.buffer(2); | |
){ | |
assertEquals(2, buf.capacity()); | |
thrown.expect(IllegalArgumentException.class); | |
// should fail but doesn't. | |
buf.slice(0, 3); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment