diff --git a/build.gradle b/build.gradle index 8aed2a42830..cc98b4143a0 100644 --- a/build.gradle +++ b/build.gradle @@ -728,3 +728,5 @@ jmh { iterations = 10 fork = 2 } + +apply plugin: 'jacoco' \ No newline at end of file diff --git a/src/test/java/org/jabref/cli/ArgumentProcessorTest.java b/src/test/java/org/jabref/cli/ArgumentProcessorTest.java index a74063b9a01..f52be1e18bd 100644 --- a/src/test/java/org/jabref/cli/ArgumentProcessorTest.java +++ b/src/test/java/org/jabref/cli/ArgumentProcessorTest.java @@ -34,6 +34,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + class ArgumentProcessorTest { @@ -73,6 +76,28 @@ void auxImport(@TempDir Path tempDir) throws Exception { assertTrue(Files.exists(outputBib)); } + + @Test + void noFileImport(@TempDir Path tempDir) throws Exception { + String auxFile = Path.of(AuxCommandLineTest.class.getResource("paper.aux").toURI()).toAbsolutePath().toString(); + String originBib = Path.of(AuxCommandLineTest.class.getResource("origin.bib").toURI()).toAbsolutePath().toString(); + String noExistBib = "nonexistant.bib"; + + Path outputBib = tempDir.resolve("output.bisb").toAbsolutePath(); + String outputBibFile = outputBib.toAbsolutePath().toString(); + + List args = List.of("--nogui", "--debug", "--aux", auxFile + "," + outputBibFile, originBib, noExistBib); + + ArgumentProcessor processor = new ArgumentProcessor( + args.toArray(String[]::new), + Mode.INITIAL_START, + preferencesService, + mock(FileUpdateMonitor.class), + entryTypesManager); + processor.processArguments(); + + assertTrue(Files.exists(outputBib)); + } @Test void exportMatches(@TempDir Path tempDir) throws Exception { @@ -103,7 +128,8 @@ void exportMatches(@TempDir Path tempDir) throws Exception { assertTrue(Files.exists(outputBib)); BibEntryAssert.assertEquals(expectedEntries, outputBib, bibtexImporter); } - + + @Test void convertBibtexToTablerefsabsbib(@TempDir Path tempDir) throws Exception { Path originBib = Path.of(Objects.requireNonNull(ArgumentProcessorTest.class.getResource("origin.bib")).toURI());