### Question:
TrieRoutingData implements MetadataStoreRoutingData { public boolean isShardingKeyInsertionValid(String shardingKey) { if (!ZkValidationUtil.isPathValid(shardingKey)) { throw new IllegalArgumentException( "Provided shardingKey is not a valid Zookeeper path: " + shardingKey); } TrieNode node = getLongestPrefixNodeAlongPath(shardingKey); return !node.isShardingKey() && !node.getPath().equals(shardingKey); } TrieRoutingData(Map<String, List<String>> routingData); Map<String, String> getAllMappingUnderPath(String path); String getMetadataStoreRealm(String path); String getShardingKeyInPath(String path); boolean isShardingKeyInsertionValid(String shardingKey); boolean containsKeyRealmPair(String shardingKey, String realmAddress);  }### Answer:
@Test(dependsOnMethods = "testConstructionNormal") public void testIsShardingKeyInsertionValidNoSlash() { try { _trie.isShardingKeyInsertionValid("x/y/z"); Assert.fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException e) { Assert.assertTrue( e.getMessage().contains("Provided shardingKey is not a valid Zookeeper path: x/y/z")); } }
@Test(dependsOnMethods = "testConstructionNormal") public void testIsShardingKeyInsertionValidSlashOnly() { Assert.assertFalse(_trie.isShardingKeyInsertionValid("/")); }
@Test(dependsOnMethods = "testConstructionNormal") public void testIsShardingKeyInsertionValidNormal() { Assert.assertTrue(_trie.isShardingKeyInsertionValid("/x/y/z")); }
@Test(dependsOnMethods = "testConstructionNormal") public void testIsShardingKeyInsertionValidParentKey() { Assert.assertFalse(_trie.isShardingKeyInsertionValid("/b/c")); }
@Test(dependsOnMethods = "testConstructionNormal") public void testIsShardingKeyInsertionValidSameKey() { Assert.assertFalse(_trie.isShardingKeyInsertionValid("/h/i")); }
@Test(dependsOnMethods = "testConstructionNormal") public void testIsShardingKeyInsertionValidChildKey() { Assert.assertFalse(_trie.isShardingKeyInsertionValid("/h/i/k")); }