xyuanlu commented on code in PR #2328:
URL: https://github.com/apache/helix/pull/2328#discussion_r1063669211


##########
zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/RealmAwareZkClientTestBase.java:
##########
@@ -67,4 +76,127 @@ public void afterClass() {
       _msdsServer.stopServer();
     }
   }
-}
+  /**
+   * Initialize requirement for testing multi support.
+   */
+  @Test
+  public void testMultiSetup() {
+    // Create a connection config with a valid sharding key
+    RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder builder =
+            new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder();
+    RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
+            builder.setZkRealmShardingKey(ZK_SHARDING_KEY_PREFIX).build();
+    try {
+      _realmAwareZkClient = new FederatedZkClient(connectionConfig,
+              new RealmAwareZkClient.RealmAwareZkClientConfig());
+    } catch (IllegalArgumentException e) {
+      Assert.fail("Invalid Sharding Key.");
+    } catch (Exception e) {

Review Comment:
   If you want to integrate these two, then you can just catch `Exception ` 
since `IllegalArgumentException` is a subclass of general `Exception ` ( 
https://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html)
   Throw the unexpected exception also work as the stack trace will contain 
enough info. 
   In my opinion both work. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to