@Test
public void testTransformBytes_Error_NotEnoughBytes() throws IOException {

  // This test sets up a trivial 1-byte "patch" (addends) stream but then asks
  // transformBytes(...) to apply *2* bytes, which should fail when it hits EOF.
  final InputStream patchIn = new ByteArrayInputStream(new byte[] {(byte) 0x00});
  copyToOldFile("bsdifftest_partial_a.txt"); // Any file would work here
  RandomAccessFile oldData = new RandomAccessFile(oldFile, "r");
  try {
    BsPatch.transformBytes(2, patchIn, oldData, new ByteArrayOutputStream(), buffer1, buffer2);
    Assert.fail("Read past EOF");
  } catch (IOException expected) {
    // Pass
  }
}