Source:
<code>public void testListingWithFallbackLinkWithSameMountDirectoryTree() throws Exception { Configuration conf = new Configuration(); conf.setBoolean(Constants.CONFIG_VIEWFS_MOUNT_LINKS_AS_SYMLINKS, false); ConfigUtil.addLink(conf, "/user1/hive/warehouse/partition-0", new Path(targetTestRoot.toString()).toUri()); Path dir1 = new Path(targetTestRoot, "fallbackDir/user1/hive/warehouse/partition-0"); Path dir2 = new Path(targetTestRoot, "fallbackDir/user1/hive/warehouse1"); fsTarget.mkdirs(dir1); fsTarget.mkdirs(dir2); fsTarget.setPermission(new Path(targetTestRoot, "fallbackDir/user1/hive/"), FsPermission.valueOf("-rwxr--r--")); URI viewFsUri = new URI(FsConstants.VIEWFS_SCHEME, Constants.CONFIG_VIEWFS_DEFAULT_MOUNT_TABLE, "/", null, null); HashSet<Path> beforeFallback = new HashSet<>(); try (FileSystem vfs = FileSystem.get(viewFsUri, conf)) { for (FileStatus stat : vfs .listStatus(new Path(viewFsUri.toString(), "/user1/hive/"))) { beforeFallback.add(stat.getPath()); } } ConfigUtil .addLinkFallback(conf, new Path(targetTestRoot, "fallbackDir").toUri()); try (FileSystem vfs = FileSystem.get(viewFsUri, conf)) { HashSet<Path> afterFallback = new HashSet<>(); for (FileStatus stat : vfs .listStatus(new Path(viewFsUri.toString(), "/user1/hive/"))) { afterFallback.add(stat.getPath()); if (dir1.getName().equals(stat.getPath().getName())) { assertEquals(FsPermission.valueOf("-rwxr--r--"), stat.getPermission()); } } afterFallback.removeAll(beforeFallback); <START> assertTrue("The same directory name in fallback link should be shaded", <END> afterFallback.size() == 1); } }</code><technical_language>nit: assertEqual()</technical_language>

Target:
public void testListingWithFallbackLinkWithSameMountDirectoryTree() throws Exception { Configuration conf = new Configuration(); conf.setBoolean(Constants.CONFIG_VIEWFS_MOUNT_LINKS_AS_SYMLINKS, false); ConfigUtil.addLink(conf, "/user1/hive/warehouse/partition-0", new Path(targetTestRoot.toString()).toUri()); Path dir1 = new Path(targetTestRoot, "fallbackDir/user1/hive/warehouse/partition-0"); Path dir2 = new Path(targetTestRoot, "fallbackDir/user1/hive/warehouse1"); fsTarget.mkdirs(dir1); fsTarget.mkdirs(dir2); fsTarget.setPermission(new Path(targetTestRoot, "fallbackDir/user1/hive/"), FsPermission.valueOf("-rwxr--r--")); URI viewFsUri = new URI(FsConstants.VIEWFS_SCHEME, Constants.CONFIG_VIEWFS_DEFAULT_MOUNT_TABLE, "/", null, null); HashSet<Path> beforeFallback = new HashSet<>(); try (FileSystem vfs = FileSystem.get(viewFsUri, conf)) { for (FileStatus stat : vfs .listStatus(new Path(viewFsUri.toString(), "/user1/hive/"))) { beforeFallback.add(stat.getPath()); } } ConfigUtil .addLinkFallback(conf, new Path(targetTestRoot, "fallbackDir").toUri()); try (FileSystem vfs = FileSystem.get(viewFsUri, conf)) { HashSet<Path> afterFallback = new HashSet<>(); for (FileStatus stat : vfs .listStatus(new Path(viewFsUri.toString(), "/user1/hive/"))) { afterFallback.add(stat.getPath()); if (dir1.getName().equals(stat.getPath().getName())) { assertEquals(FsPermission.valueOf("-rwxr--r--"), stat.getPermission()); } } afterFallback.removeAll(beforeFallback); assertEquals("The same directory name in fallback link should be shaded", 1, afterFallback.size()); } }