justinmclean commented on code in PR #6104:
URL: https://github.com/apache/gravitino/pull/6104#discussion_r1903474608


##########
clients/cli/src/test/java/org/apache/gravitino/cli/TestCatalogCommands.java:
##########
@@ -234,10 +258,60 @@ void testSetCatalogPropertyCommand() {
             "catalog",
             "property",
             "value");
+    doReturn(mockSetProperty).when(mockSetProperty).validate();
     commandLine.handleCommandLine();
     verify(mockSetProperty).handle();
   }
 
+  @Test
+  void testSetCatalogPropertyCommandWithoutPropertyAndValue() {
+    Main.useExit = false;
+    SetCatalogProperty mockSetProperty =
+        spy(
+            new SetCatalogProperty(
+                GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo", 
"catalog", null, null));
+
+    assertThrows(RuntimeException.class, mockSetProperty::validate);
+    String errOutput = new String(errContent.toByteArray(), 
StandardCharsets.UTF_8).trim();
+    assertEquals("Missing --property and --value options.", errOutput);

Review Comment:
   use ErrorMessages.xxx here



-- 
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]

Reply via email to