public MetadataBlockType getType() {
    return _errCodeToExceptionMap.isEmpty() ? MetadataBlockType.EOS : MetadataBlockType.ERROR;
  }
@Test
  public void v2EosWithoutStatsIsReadInV1AsEosWithoutStats()
      throws IOException {
    ByteBuffer stats = ByteBuffer.wrap(new byte[]{0, 0, 0, 0});
    MetadataBlock metadataBlock = new MetadataBlock(Lists.newArrayList(stats));

    byte[] bytes = metadataBlock.toBytes();

    // This is how V1 blocks were deserialized
    ByteBuffer buff = ByteBuffer.wrap(bytes);
    DataBlockUtils.readVersionType(buff); // consume the version information before decoding
    V1MetadataBlock v1MetadataBlock = new V1MetadataBlock(buff);

    assertEquals(v1MetadataBlock.getType(), MetadataBlock.MetadataBlockType.EOS, "Expected EOS type");
    assertEquals(v1MetadataBlock.getStats(), Collections.emptyMap(), "Expected no stats by stage");
    assertEquals(v1MetadataBlock.getExceptions(), metadataBlock.getExceptions(), "Expected no exceptions");
  }