This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new e56536bf14 [Minor] Remove unneeded eq's from tests (#6241)
e56536bf14 is described below
commit e56536bf147e584fd9fec1e0b90ea343f037eca6
Author: Justin Mclean <[email protected]>
AuthorDate: Tue Jan 21 16:10:24 2025 +1100
[Minor] Remove unneeded eq's from tests (#6241)
### What changes were proposed in this pull request?
No need for these eq's.
### Why are the changes needed?
As above
Fix: #N/A
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Run locally, test passed.
Co-authored-by: Shaofeng Shi <[email protected]>
---
.../apache/gravitino/cli/TestModelCommands.java | 48 ++++------------------
.../apache/gravitino/cli/TestOwnerCommands.java | 26 ++++++------
.../org/apache/gravitino/cli/TestRoleCommands.java | 18 ++++----
3 files changed, 28 insertions(+), 64 deletions(-)
diff --git
a/clients/cli/src/test/java/org/apache/gravitino/cli/TestModelCommands.java
b/clients/cli/src/test/java/org/apache/gravitino/cli/TestModelCommands.java
index b83cc3c313..4f1507cc70 100644
--- a/clients/cli/src/test/java/org/apache/gravitino/cli/TestModelCommands.java
+++ b/clients/cli/src/test/java/org/apache/gravitino/cli/TestModelCommands.java
@@ -89,11 +89,7 @@ public class TestModelCommands {
doReturn(mockList)
.when(commandLine)
.newListModel(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq("catalog"),
- eq("schema"));
+ GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo",
"catalog", "schema");
doReturn(mockList).when(mockList).validate();
commandLine.handleCommandLine();
verify(mockList).handle();
@@ -112,12 +108,7 @@ public class TestModelCommands {
assertThrows(RuntimeException.class, commandLine::handleCommandLine);
verify(commandLine, never())
- .newListModel(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- isNull(),
- isNull());
+ .newListModel(GravitinoCommandLine.DEFAULT_URL, false,
"metalake_demo", null, null);
String output = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(
ErrorMessages.MISSING_NAME
@@ -141,12 +132,7 @@ public class TestModelCommands {
assertThrows(RuntimeException.class, commandLine::handleCommandLine);
verify(commandLine, never())
- .newListModel(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq("catalog"),
- isNull());
+ .newListModel(GravitinoCommandLine.DEFAULT_URL, false,
"metalake_demo", "catalog", null);
String output = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(
ErrorMessages.MALFORMED_NAME
@@ -171,12 +157,7 @@ public class TestModelCommands {
doReturn(mockList)
.when(commandLine)
.newModelDetails(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq("catalog"),
- eq("schema"),
- eq("model"));
+ GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo",
"catalog", "schema", "model");
doReturn(mockList).when(mockList).validate();
commandLine.handleCommandLine();
verify(mockList).handle();
@@ -197,12 +178,7 @@ public class TestModelCommands {
verify(commandLine, never())
.newModelDetails(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- isNull(),
- isNull(),
- isNull());
+ GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo", null,
null, null);
String output = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(
ErrorMessages.MISSING_NAME
@@ -230,12 +206,7 @@ public class TestModelCommands {
verify(commandLine, never())
.newModelDetails(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq("catalog"),
- isNull(),
- isNull());
+ GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo",
"catalog", null, null);
String output = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(
ErrorMessages.MALFORMED_NAME
@@ -261,12 +232,7 @@ public class TestModelCommands {
verify(commandLine, never())
.newModelDetails(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq("catalog"),
- eq("schema"),
- isNull());
+ GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo",
"catalog", "schema", null);
String output = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(
ErrorMessages.MALFORMED_NAME
diff --git
a/clients/cli/src/test/java/org/apache/gravitino/cli/TestOwnerCommands.java
b/clients/cli/src/test/java/org/apache/gravitino/cli/TestOwnerCommands.java
index 12f617380c..f3928fba28 100644
--- a/clients/cli/src/test/java/org/apache/gravitino/cli/TestOwnerCommands.java
+++ b/clients/cli/src/test/java/org/apache/gravitino/cli/TestOwnerCommands.java
@@ -21,8 +21,6 @@ package org.apache.gravitino.cli;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -160,11 +158,11 @@ class TestOwnerCommands {
assertThrows(RuntimeException.class, commandLine::handleCommandLine);
verify(commandLine, never())
.newOwnerDetails(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq(null),
- eq(CommandEntities.CATALOG));
+ GravitinoCommandLine.DEFAULT_URL,
+ false,
+ "metalake_demo",
+ null,
+ CommandEntities.CATALOG);
String errOutput = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(ErrorMessages.MISSING_NAME, errOutput);
@@ -188,13 +186,13 @@ class TestOwnerCommands {
assertThrows(RuntimeException.class, commandLine::handleCommandLine);
verify(commandLine, never())
.newSetOwner(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq("postgres"),
- eq(CommandEntities.CATALOG),
- isNull(),
- eq(false));
+ GravitinoCommandLine.DEFAULT_URL,
+ false,
+ "metalake_demo",
+ "postgres",
+ CommandEntities.CATALOG,
+ null,
+ false);
String errOutput = new String(errContent.toByteArray(),
StandardCharsets.UTF_8).trim();
assertEquals(ErrorMessages.INVALID_SET_COMMAND, errOutput);
}
diff --git
a/clients/cli/src/test/java/org/apache/gravitino/cli/TestRoleCommands.java
b/clients/cli/src/test/java/org/apache/gravitino/cli/TestRoleCommands.java
index 2b4ab47452..be463019fd 100644
--- a/clients/cli/src/test/java/org/apache/gravitino/cli/TestRoleCommands.java
+++ b/clients/cli/src/test/java/org/apache/gravitino/cli/TestRoleCommands.java
@@ -185,10 +185,10 @@ class TestRoleCommands {
doReturn(mockCreate)
.when(commandLine)
.newCreateRole(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq("metalake_demo"),
- eq(new String[] {"admin", "engineer", "scientist"}));
+ GravitinoCommandLine.DEFAULT_URL,
+ false,
+ "metalake_demo",
+ new String[] {"admin", "engineer", "scientist"});
doReturn(mockCreate).when(mockCreate).validate();
commandLine.handleCommandLine();
verify(mockCreate).handle();
@@ -235,11 +235,11 @@ class TestRoleCommands {
doReturn(mockDelete)
.when(commandLine)
.newDeleteRole(
- eq(GravitinoCommandLine.DEFAULT_URL),
- eq(false),
- eq(false),
- eq("metalake_demo"),
- eq(new String[] {"admin", "engineer", "scientist"}));
+ GravitinoCommandLine.DEFAULT_URL,
+ false,
+ false,
+ "metalake_demo",
+ new String[] {"admin", "engineer", "scientist"});
doReturn(mockDelete).when(mockDelete).validate();
commandLine.handleCommandLine();
verify(mockDelete).handle();