Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Minor] Remove unneeded eq's from tests #6241

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ void testListModelCommand() {
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();
Expand All @@ -112,12 +108,7 @@ void testListModelCommandWithoutCatalog() {

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
Expand All @@ -141,12 +132,7 @@ void testListModelCommandWithoutSchema() {

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
Expand All @@ -171,12 +157,7 @@ void testModelDetailsCommand() {
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();
Expand All @@ -197,12 +178,7 @@ void testModelDetailsCommandWithoutCatalog() {

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
Expand Down Expand Up @@ -230,12 +206,7 @@ void testModelDetailsCommandWithoutSchema() {

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
Expand All @@ -261,12 +232,7 @@ void testModelDetailsCommandWithoutModel() {

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

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;
Expand Down Expand Up @@ -160,11 +158,11 @@ void testOwnerDetailsCommandWithoutName() {
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);
Expand All @@ -188,13 +186,13 @@ void testSetOwnerUserCommandWithoutUserAndGroup() {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ void testCreateRolesCommand() {
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();
Expand Down Expand Up @@ -235,11 +235,11 @@ void testDeleteRolesCommand() {
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();
Expand Down
Loading