@Test public void readWriteProgramGoodTest() { final byte[] exp = aProgram; final ProgramHandle hProg = ProgramHandle.read(exp, 0, exp.length); try { final int size = hProg.size(); assertEquals(exp.length, size); final byte[] buf = new byte[size]; hProg.write(buf, 0); assertArrayEquals(exp, buf); } finally { hProg.destroy(); } }
@Test(expected = IndexOutOfBoundsException.class) public void readProgramOffsetTooLargeTest() { final byte[] exp = aProgram; final ProgramHandle hProg = ProgramHandle.read(exp, 1, exp.length); }
@Test(expected = NullPointerException.class) public void readProgramNullBufferTest() { final ProgramHandle hProg = ProgramHandle.read(null, 0, 1); }