JsonUtil { private static String toString(final FsPermission permission) { return String.format("%o", permission.toShort()); }  static String toJsonString(final Token<? extends TokenIdentifier> token
      ); static String toJsonString(final Exception e); static String toJsonString(final String key, final Object value); static String toJsonString(final HdfsFileStatus status,
      boolean includeType); static Map<String, Object> getEcPolicyAsMap(
      final ErasureCodingPolicy ecPolicy); static String toJsonString(final DirectoryListing listing); static String toJsonString(final LocatedBlocks locatedblocks
      ); static String toJsonString(final ContentSummary contentsummary); static String toJsonString(final QuotaUsage quotaUsage); static String toJsonString(final MD5MD5CRC32FileChecksum checksum); static String toJsonString(final AclStatus status); static String toJsonString(final List<XAttr> xAttrs, 
      final XAttrCodec encoding); static String toJsonString(final List<XAttr> xAttrs); static String toJsonString(Object obj); static String toJsonString(BlockStoragePolicy[] storagePolicies); static String toJsonString(BlockStoragePolicy storagePolicy); static String toJsonString(FsServerDefaults serverDefaults); static String toJsonString(SnapshotDiffReport diffReport); static String toJsonString(
      SnapshottableDirectoryStatus[] snapshottableDirectoryList); static String toJsonString(SnapshotStatus[] snapshotList); static String toJsonString(BlockLocation[] locations);  }
@Test public void testHdfsFileStatus() throws Exception { HdfsFileStatus hdfsFileStatus = new HdfsFileStatus.Builder() .replication(1) .blocksize(1024) .perm(new FsPermission((short) 777)) .owner("owner") .group("group") .symlink(new byte[0]) .path(new byte[0]) .fileId(1010) .isdir(true) .build(); assertFalse(hdfsFileStatus.isSymlink()); LambdaTestUtils.intercept(IOException.class, "Path " + hdfsFileStatus.getPath() + " is not a symbolic link", () -> hdfsFileStatus.getSymlink()); String expectString = new StringBuilder() .append("HdfsLocatedFileStatus") .append("{") .append("path=" + null) .append("; isDirectory=" + true) .append("; modification_time=" + 0) .append("; access_time=" + 0) .append("; owner=" + "owner") .append("; group=" + "group") .append("; permission=" + "r----x--t") .append("; isSymlink=" + false) .append("; hasAcl=" + false) .append("; isEncrypted=" + false) .append("; isErasureCoded=" + false) .append("}") .toString(); assertEquals(expectString, hdfsFileStatus.toString()); }