Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yhanyi committed Nov 9, 2024
1 parent 254bbd5 commit e04bcc2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.stream.Collectors;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down Expand Up @@ -362,7 +363,7 @@ public void escapeSpecialCharacters_withSpecialChars() {
public void validateFilename_withPathComponents_throwsCommandException() {
String filenameWithPath = "folder" + File.separator + "file";
ExportConsultCommand exportCommand = new ExportConsultCommand(filenameWithPath, false, dataDir);
assertThrows(CommandException.class, () -> exportCommand.execute(model),
Assertions.assertThrows(CommandException.class, () -> exportCommand.execute(model),
"Filename cannot contain path components");
}

Expand All @@ -372,14 +373,14 @@ public void validateFilename_multiplePathComponents_throwsCommandException() {
String filenameWithPath = "parent.child.file";
ExportConsultCommand exportCommand = new ExportConsultCommand(filenameWithPath, false, dataDir);

assertThrows(CommandException.class, () -> exportCommand.execute(model),
Assertions.assertThrows(CommandException.class, () -> exportCommand.execute(model),
"Filename cannot contain path components");

// Also test with explicit path separator
String explicitPath = "parent" + File.separator + "child" + File.separator + "file";
ExportConsultCommand exportCommand2 = new ExportConsultCommand(explicitPath, false, dataDir);

assertThrows(CommandException.class, () -> exportCommand2.execute(model),
Assertions.assertThrows(CommandException.class, () -> exportCommand2.execute(model),
"Filename cannot contain path components");
}
}

0 comments on commit e04bcc2

Please sign in to comment.