@Test
public void testHdfsFileStatusWithEcPolicy() throws IOException {

  final long now = Time.now();
  final String parent = "/dir";
  ErasureCodingPolicy dummyEcPolicy = new ErasureCodingPolicy("ecPolicy1",
      new ECSchema("EcSchema", 1, 1), 1024 * 2, (byte) 1);
  final HdfsFileStatus status = new HdfsFileStatus.Builder()
      .length(1001L)
      .replication(3)
      .blocksize(1L << 26)
      .mtime(now)
      .atime(now + 10)
      .perm(new FsPermission((short) 0644))
      .owner("user")
      .group("group")
      .symlink(DFSUtil.string2Bytes("bar"))
      .path(DFSUtil.string2Bytes("foo"))
      .fileId(HdfsConstants.GRANDFATHER_INODE_ID)
      .ecPolicy(dummyEcPolicy)
      .flags(EnumSet.allOf(Flags.class))
      .build();
  final FileStatus fstatus = toFileStatus(status, parent);
  System.out.println("status  = " + status);
  System.out.println("fstatus = " + fstatus);
  final String json = JsonUtil.toJsonString(status, true);
  System.out.println("json    = " + json.replace(",", ",\n  "));
  final HdfsFileStatus s2 =
      JsonUtilClient.toFileStatus((Map<?, ?>) READER.readValue(json), true);
  final FileStatus fs2 = toFileStatus(s2, parent);
  System.out.println("s2      = " + s2);
  System.out.println("fs2     = " + fs2);
  Assert.assertEquals(status.getErasureCodingPolicy(),
      s2.getErasureCodingPolicy());
  Assert.assertEquals(fstatus, fs2);
}