Skip to content

Commit e9e42ee

Browse files
committed
Add missing tests
1 parent d27dc59 commit e9e42ee

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

data-loader/cli/src/test/java/com/scalar/db/dataloader/cli/command/dataimport/ImportCommandTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,34 @@ void call_withOnlyDeprecatedLogSuccess_shouldApplyValue() throws Exception {
199199
// Verify the value was applied to enable-log-success
200200
assertTrue(command.enableLogSuccessRecords);
201201
}
202+
203+
@Test
204+
void call_withEnableLogSuccess_shouldSetToTrueWithoutValue() throws Exception {
205+
Path importFile = tempDir.resolve("import.json");
206+
Files.createFile(importFile);
207+
208+
// Simulate command line parsing with the new flag without providing true/false value
209+
String[] args = {"--file", importFile.toString(), "--enable-log-success"};
210+
ImportCommand command = new ImportCommand();
211+
CommandLine cmd = new CommandLine(command);
212+
cmd.parseArgs(args);
213+
214+
// Verify the flag was parsed correctly without requiring a value
215+
assertTrue(command.enableLogSuccessRecords);
216+
}
217+
218+
@Test
219+
void call_withEnableLogSuccessShortForm_shouldSetToTrueWithoutValue() throws Exception {
220+
Path importFile = tempDir.resolve("import.json");
221+
Files.createFile(importFile);
222+
223+
// Simulate command line parsing with the short form flag without providing true/false value
224+
String[] args = {"--file", importFile.toString(), "-ls"};
225+
ImportCommand command = new ImportCommand();
226+
CommandLine cmd = new CommandLine(command);
227+
cmd.parseArgs(args);
228+
229+
// Verify the short form flag was parsed correctly without requiring a value
230+
assertTrue(command.enableLogSuccessRecords);
231+
}
202232
}

0 commit comments

Comments
 (0)