### Question:
ZkMetadataStoreDirectory implements MetadataStoreDirectory, RoutingDataListener { @Override public Map<String, String> getAllMappingUnderPath(String namespace, String path) { if (!_routingZkAddressMap.containsKey(namespace)) { throw new NoSuchElementException( "Failed to get all mapping under path: Namespace " + namespace + " is not found!"); } if (!_routingDataMap.containsKey(namespace)) { throw new IllegalStateException("Failed to get all mapping under path: Namespace " + namespace + " contains either empty or invalid routing data!"); } return _routingDataMap.get(namespace).getAllMappingUnderPath(path); } @VisibleForTesting protected  ZkMetadataStoreDirectory(); static ZkMetadataStoreDirectory getInstance(); static ZkMetadataStoreDirectory getInstance(String namespace, String zkAddress); @Override Collection<String> getAllNamespaces(); @Override Collection<String> getAllMetadataStoreRealms(String namespace); @Override Collection<String> getAllShardingKeys(String namespace); @Override Map<String, List<String>> getNamespaceRoutingData(String namespace); @Override boolean setNamespaceRoutingData(String namespace, Map<String, List<String>> routingData); @Override Collection<String> getAllShardingKeysInRealm(String namespace, String realm); @Override Map<String, String> getAllMappingUnderPath(String namespace, String path); @Override String getMetadataStoreRealm(String namespace, String shardingKey); @Override boolean addMetadataStoreRealm(String namespace, String realm); @Override boolean deleteMetadataStoreRealm(String namespace, String realm); @Override boolean addShardingKey(String namespace, String realm, String shardingKey); @Override boolean deleteShardingKey(String namespace, String realm, String shardingKey); @Override void refreshRoutingData(String namespace); @Override synchronized void close(); static void createRoutingDataPath(HelixZkClient zkClient, String zkAddress);  }### Answer:
@Test(dependsOnMethods = "testGetAllShardingKeysInRealm") public void testGetAllMappingUnderPath() { Map<String, String> mappingFromRoot = new HashMap<>(); TEST_SHARDING_KEYS_1.forEach(shardingKey -> { mappingFromRoot.put(shardingKey, TEST_REALM_1); }); TEST_SHARDING_KEYS_2.forEach(shardingKey -> { mappingFromRoot.put(shardingKey, TEST_REALM_2); }); Map<String, String> mappingFromLeaf = new HashMap<>(1); mappingFromLeaf.put("/sharding/key/1/a", TEST_REALM_1); for (String namespace : _routingZkAddrMap.keySet()) { Assert.assertEquals(_metadataStoreDirectory.getAllMappingUnderPath(namespace, "/"), mappingFromRoot); Assert.assertEquals( _metadataStoreDirectory.getAllMappingUnderPath(namespace, "/sharding/key/1/a"), mappingFromLeaf); } }