@Test
public void testApplyPatch_TruncatedSignature() throws Exception {

  createEmptyOldFile(10);
  InputStream patchIn = new ByteArrayInputStream("X".getBytes("US-ASCII"));
  ByteArrayOutputStream newData = new ByteArrayOutputStream();
  try {
    BsPatch.applyPatch(new RandomAccessFile(oldFile, "r"), newData, patchIn);
    Assert.fail("Read patch with truncated signature");
  } catch (PatchFormatException expected) {
    // No way to mock the internal logic, so resort to testing exception string for coverage
    String actual = expected.getMessage();
    Assert.assertEquals("truncated signature", actual);
  }
}