justinmclean commented on code in PR #6163:
URL: https://github.com/apache/gravitino/pull/6163#discussion_r1917558010
##########
clients/cli/src/test/java/org/apache/gravitino/cli/TestMetalakeCommands.java:
##########
@@ -435,20 +433,23 @@ void testDisableMetalakeCommand() {
void testMetalakeWithDisableAndEnableOptions() {
Main.useExit = false;
when(mockCommandLine.hasOption(GravitinoOptions.METALAKE)).thenReturn(true);
-
when(mockCommandLine.getOptionValue(CommandEntities.METALAKE)).thenReturn("metalake_demo");
- when(mockCommandLine.hasOption(GravitinoOptions.ENABLE)).thenReturn(true);
+
when(mockCommandLine.getOptionValue(GravitinoOptions.METALAKE)).thenReturn("metalake_demo");
when(mockCommandLine.hasOption(GravitinoOptions.DISABLE)).thenReturn(true);
+ when(mockCommandLine.hasOption(GravitinoOptions.ENABLE)).thenReturn(true);
GravitinoCommandLine commandLine =
spy(
new GravitinoCommandLine(
mockCommandLine, mockOptions, CommandEntities.METALAKE,
CommandActions.UPDATE));
- Assert.assertThrows(RuntimeException.class,
commandLine::handleCommandLine);
- verify(commandLine, never())
- .newMetalakeEnable(GravitinoCommandLine.DEFAULT_URL, false,
"metalake_demo", false);
- verify(commandLine, never())
- .newMetalakeEnable(GravitinoCommandLine.DEFAULT_URL, false,
"metalake_demo", false);
-
assertTrue(errContent.toString().contains(ErrorMessages.INVALID_ENABLE_DISABLE));
+ assertThrows(
+ RuntimeException.class,
+ () ->
+ commandLine
+ .newMetalakeEnable(
+ GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo",
true, false)
+ .validate());
+ String errOutput = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
+ Assertions.assertEquals(ErrorMessages.INVALID_ENABLE_DISABLE, errOutput);
Review Comment:
Same here, I'm not sure these changes are required.
--
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]