@Test(expected = BadCheckpointException.class)
public void testCheckpointVersionNotEqualToMeta2() throws Exception {

  FileOutputStream os = null;
  try {
    EventQueueBackingStore backingStore =
        EventQueueBackingStoreFactory.get(checkpoint, 10, "test", new FileChannelCounter("test"));
    backingStore.close();
    Assert.assertTrue(checkpoint.exists());
    Assert.assertTrue(Serialization.getMetaDataFile(checkpoint).length() != 0);
    FileInputStream is = new FileInputStream(Serialization.getMetaDataFile(checkpoint));
    ProtosFactory.Checkpoint meta = ProtosFactory.Checkpoint.parseDelimitedFrom(is);
    Assert.assertNotNull(meta);
    is.close();
    os = new FileOutputStream(Serialization.getMetaDataFile(checkpoint));
    meta.toBuilder().setVersion(2).build().writeDelimitedTo(os);
    os.flush();
    backingStore = EventQueueBackingStoreFactory.get(
        checkpoint, 10, "test", new FileChannelCounter("test")
    );
  } finally {
    os.close();
  }
}