NealSun96 commented on a change in pull request #761: Add REST read endpoints 
to helix-rest for metadata store directory
URL: https://github.com/apache/helix/pull/761#discussion_r380997605
 
 

 ##########
 File path: 
helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
 ##########
 @@ -110,7 +110,33 @@ public void beforeClass() throws Exception {
     _metadataStoreDirectory = new ZkMetadataStoreDirectory(routingZkAddrMap);
   }
 
+  /*
+   * Tests REST endpoint: "GET 
/namespaces/{namespace}/metadata-store-namespaces"
+   */
   @Test
+  public void testGetAllNamespaces() throws IOException {
+    String responseBody = get(TEST_NAMESPACE_URI_PREFIX + 
"/metadata-store-namespaces", null,
+        Response.Status.OK.getStatusCode(), true);
+
+    // It is safe to cast the object and suppress warnings.
+    @SuppressWarnings("unchecked")
+    Map<String, Collection<String>> queriedNamespacesMap =
+        OBJECT_MAPPER.readValue(responseBody, Map.class);
+
+    Assert.assertTrue(
+        
queriedNamespacesMap.containsKey(MetadataStoreRoutingConstants.METADATA_STORE_NAMESPACES));
 
 Review comment:
   When verifying a map, I'd make sure that "it contains the right elements and 
**only** the right elements". Therefore I usually perform a check on map length 
- without it if the map returns something extra and unexpected, the test cases 
would still incorrectly pass. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org
For additional commands, e-mail: reviews-h...@helix.apache.org

Reply via email to