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

add: add test cases for FileUtil #8810

Merged
merged 4 commits into from
May 18, 2022
Merged
Changes from 2 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
17 changes: 17 additions & 0 deletions src/test/java/org/jabref/logic/util/io/FileUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,21 @@ void testIsNotBibFile() throws IOException {
Path bibFile = Files.createFile(rootDir.resolve("test.pdf"));
assertFalse(FileUtil.isBibFile(bibFile));
}

@Test
void testFindinPath() {
Optional<Path> resultPath1 = FileUtil.find("existingTestFile.txt", rootDir);
assertEquals(resultPath1.get().toString(), existingTestFile.toString());
}

@Test
void testFindinListofPath() {
Path[] pathArr = {existingTestFile, otherExistingTestFile, rootDir};
List<Path> paths = Arrays.asList(pathArr);
Christina0114 marked this conversation as resolved.
Show resolved Hide resolved
Path[] resultArr = {existingTestFile, existingTestFile};
List<Path> resultPaths = Arrays.asList(resultArr);
List<Path> result = FileUtil.find("existingTestFile.txt", paths);
System.out.println(result.toString());
assertEquals(resultPaths, result);
}
}