@Test
public void testTransformBytes_Error_JunkPatch_Underflow() throws IOException {

  final byte[] patchInput = "this is a sample string".getBytes("US-ASCII");
  final ByteArrayInputStream patchInputStream = new ByteArrayInputStream(patchInput);
  copyToOldFile("bsdifftest_partial_a.txt");
  RandomAccessFile oldData = new RandomAccessFile(oldFile, "r");
  final byte[] buffer1 = new byte[6];
  final byte[] buffer2 = new byte[6];
  ByteArrayOutputStream newData = new ByteArrayOutputStream();
  try {
    BsPatch.transformBytes(
        patchInput.length + 1, patchInputStream, oldData, newData, buffer1, buffer2);
    Assert.fail("Should have thrown an IOException");
  } catch (IOException expected) {
    // Pass
  }
}