Skip to content

Commit e56addd

Browse files
committed
Add unit tests for SearchRxivExporter
1 parent e328d77 commit e56addd

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

‎jablib/src/test/java/org/jabref/logic/exporter/SearchRxivExporterTest.java‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,14 @@ private Study buildStudy() {
3434
void exportCreatesOneFilePerQueryAndDatabase(@TempDir Path tempDir) throws Exception {
3535
exporter.export(buildStudy(), tempDir);
3636

37-
try (var files = Files.list(tempDir)) {
38-
assertEquals(1, files.count());
39-
}
37+
assertEquals(1, Files.list(tempDir).count());
4038
}
4139

4240
@Test
4341
void exportedJsonContainsCorrectFields(@TempDir Path tempDir) throws Exception {
4442
exporter.export(buildStudy(), tempDir);
4543

46-
Path file;
47-
try (var files = Files.list(tempDir)) {
48-
file = files.findFirst().orElseThrow();
49-
}
44+
Path file = Files.list(tempDir).findFirst().orElseThrow();
5045
String content = Files.readString(file);
5146
ObjectMapper mapper = new ObjectMapper();
5247
JsonNode root = mapper.readTree(content);
@@ -71,8 +66,6 @@ void exportCreatesMultipleFilesForMultipleDatabases(@TempDir Path tempDir) throw
7166

7267
exporter.export(study, tempDir);
7368

74-
try (var files = Files.list(tempDir)) {
75-
assertEquals(2, files.count());
76-
}
69+
assertEquals(2, Files.list(tempDir).count());
7770
}
7871
}

0 commit comments

Comments
 (0)