diff --git a/build.gradle b/build.gradle index 9464b267ca7..fc1c0fec81d 100644 --- a/build.gradle +++ b/build.gradle @@ -165,7 +165,6 @@ dependencies { testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.4.0' testCompile 'org.junit.platform:junit-platform-launcher:1.4.0' - testCompile 'org.junit-pioneer:junit-pioneer:0.3.0' testRuntime 'org.apache.logging.log4j:log4j-core:2.11.1' testRuntime 'org.apache.logging.log4j:log4j-jul:2.11.1' testCompile 'org.mockito:mockito-core:2.24.0' @@ -190,9 +189,6 @@ dependencyUpdates { outputFormatter = "json" } -//We have to use this as long as junit-pioneer has no official release -dependencyUpdates.revision = 'integration' - // We have some dependencies which cannot be updated due to various reasons. dependencyUpdates.resolutionStrategy = { componentSelection { rules -> diff --git a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java index ae1b46fe557..54be381f4b5 100644 --- a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java @@ -16,15 +16,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) public class AutoSetFileLinksUtilTest { private final FilePreferences fileDirPrefs = mock(FilePreferences.class); @@ -34,7 +32,7 @@ public class AutoSetFileLinksUtilTest { private final BibEntry entry = new BibEntry(BibtexEntryTypes.ARTICLE); @BeforeEach - public void setUp(@TempDirectory.TempDir Path folder) throws Exception { + public void setUp(@TempDir Path folder) throws Exception { Path path = folder.resolve("CiteKey.pdf"); Files.createFile(path); entry.setCiteKey("CiteKey"); diff --git a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java index a2fcce655cf..7a7893c6d79 100644 --- a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java +++ b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java @@ -17,8 +17,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -31,7 +30,6 @@ import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) class LinkedFileViewModelTest { private Path tempFile; @@ -43,7 +41,7 @@ class LinkedFileViewModelTest { private DialogService dialogService; @BeforeEach - void setUp(@TempDirectory.TempDir Path tempFolder) throws Exception { + void setUp(@TempDir Path tempFolder) throws Exception { entry = new BibEntry(); databaseContext = new BibDatabaseContext(); taskExecutor = mock(TaskExecutor.class); diff --git a/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java b/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java index 77e7d20cc36..96f00ed4065 100644 --- a/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java +++ b/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java @@ -23,8 +23,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.jabref.logic.util.OS.NEWLINE; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -37,7 +36,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) class ManageJournalAbbreviationsViewModelTest { private ManageJournalAbbreviationsViewModel viewModel; @@ -50,7 +48,7 @@ class ManageJournalAbbreviationsViewModelTest { private DialogService dialogService; @BeforeEach - void setUpViewModel(@TempDirectory.TempDir Path tempFolder) throws Exception { + void setUpViewModel(@TempDir Path tempFolder) throws Exception { abbreviationPreferences = mock(JournalAbbreviationPreferences.class); PreferencesService preferences = mock(PreferencesService.class); when(preferences.getJournalAbbreviationPreferences()).thenReturn(abbreviationPreferences); diff --git a/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java b/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java index 2a19e5593a6..5f608f0ef4a 100644 --- a/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java +++ b/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java @@ -12,16 +12,14 @@ import org.jabref.logic.util.StandardFileType; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; -@ExtendWith(TempDirectory.class) class FileDialogConfigurationTest { @Test - void testWithValidDirectoryString(@TempDirectory.TempDir Path folder) { + void testWithValidDirectoryString(@TempDir Path folder) { String tempFolder = folder.toAbsolutePath().toString(); FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() @@ -31,7 +29,7 @@ void testWithValidDirectoryString(@TempDirectory.TempDir Path folder) { } @Test - void testWithValidDirectoryPath(@TempDirectory.TempDir Path tempFolder) { + void testWithValidDirectoryPath(@TempDir Path tempFolder) { FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() .withInitialDirectory(tempFolder).build(); diff --git a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 567dffd1f6a..46431376144 100644 --- a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -34,8 +34,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -44,14 +43,13 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) class CleanupWorkerTest { private final CleanupPreset emptyPreset = new CleanupPreset(EnumSet.noneOf(CleanupPreset.CleanupStep.class)); private CleanupWorker worker; @BeforeEach - void setUp(@TempDirectory.TempDir Path bibFolder) throws IOException { + void setUp(@TempDir Path bibFolder) throws IOException { Path path = bibFolder.resolve("ARandomlyNamedFolder"); Files.createDirectory(path); @@ -82,7 +80,7 @@ void cleanupNullEntryThrowsException() { } @Test - void cleanupDoesNothingByDefault(@TempDirectory.TempDir Path bibFolder) throws IOException { + void cleanupDoesNothingByDefault(@TempDir Path bibFolder) throws IOException { BibEntry entry = new BibEntry(); entry.setCiteKey("Toot"); entry.setField("pdf", "aPdfFile"); @@ -220,7 +218,7 @@ void cleanupFixFileLinksMovesSingleDescriptionToLink() { } @Test - void cleanupMoveFilesMovesFileFromSubfolder(@TempDirectory.TempDir Path bibFolder) throws IOException { + void cleanupMoveFilesMovesFileFromSubfolder(@TempDir Path bibFolder) throws IOException { CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.MOVE_PDF); Path path = bibFolder.resolve("AnotherRandomlyNamedFolder"); @@ -238,7 +236,7 @@ void cleanupMoveFilesMovesFileFromSubfolder(@TempDirectory.TempDir Path bibFolde } @Test - void cleanupRelativePathsConvertAbsoluteToRelativePath(@TempDirectory.TempDir Path bibFolder) throws IOException { + void cleanupRelativePathsConvertAbsoluteToRelativePath(@TempDir Path bibFolder) throws IOException { CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.MAKE_PATHS_RELATIVE); Path path = bibFolder.resolve("AnotherRandomlyNamedFile"); @@ -254,7 +252,7 @@ void cleanupRelativePathsConvertAbsoluteToRelativePath(@TempDirectory.TempDir Pa } @Test - void cleanupRenamePdfRenamesRelativeFile(@TempDirectory.TempDir Path bibFolder) throws IOException { + void cleanupRenamePdfRenamesRelativeFile(@TempDir Path bibFolder) throws IOException { CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.RENAME_PDF); Path path = bibFolder.resolve("AnotherRandomlyNamedFile.tmp"); diff --git a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java index 9e9d21bfbd0..bfb0501b11a 100644 --- a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java @@ -17,8 +17,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -26,7 +25,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) class MoveFilesCleanupTest { private Path defaultFileFolder; @@ -36,7 +34,7 @@ class MoveFilesCleanupTest { private FilePreferences filePreferences; @BeforeEach - void setUp(@TempDirectory.TempDir Path bibFolder) throws IOException { + void setUp(@TempDir Path bibFolder) throws IOException { // The folder where the files should be moved to defaultFileFolder = bibFolder.resolve("pdf"); Files.createDirectory(defaultFileFolder); diff --git a/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java index eb027f824d0..53449106ff4 100644 --- a/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java @@ -17,14 +17,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) class RenamePdfCleanupTest { private BibEntry entry; @@ -33,7 +31,7 @@ class RenamePdfCleanupTest { private RenamePdfCleanup cleanup; @BeforeEach - void setUp(@TempDirectory.TempDir Path testFolder) { + void setUp(@TempDir Path testFolder) { Path path = testFolder.resolve("test.bib"); MetaData metaData = new MetaData(); BibDatabaseContext context = new BibDatabaseContext(new BibDatabase(), metaData, new Defaults()); @@ -51,7 +49,7 @@ void setUp(@TempDirectory.TempDir Path testFolder) { * Test for #466 */ @Test - void cleanupRenamePdfRenamesFileEvenIfOnlyDifferenceIsCase(@TempDirectory.TempDir Path testFolder) throws IOException { + void cleanupRenamePdfRenamesFileEvenIfOnlyDifferenceIsCase(@TempDir Path testFolder) throws IOException { Path path = testFolder.resolve("toot.tmp"); Files.createFile(path); @@ -66,7 +64,7 @@ void cleanupRenamePdfRenamesFileEvenIfOnlyDifferenceIsCase(@TempDirectory.TempDi } @Test - void cleanupRenamePdfRenamesWithMultipleFiles(@TempDirectory.TempDir Path testFolder) throws IOException { + void cleanupRenamePdfRenamesWithMultipleFiles(@TempDir Path testFolder) throws IOException { Path path = testFolder.resolve("Toot.tmp"); Files.createFile(path); @@ -84,7 +82,7 @@ void cleanupRenamePdfRenamesWithMultipleFiles(@TempDirectory.TempDir Path testFo } @Test - void cleanupRenamePdfRenamesFileStartingWithBibtexKey(@TempDirectory.TempDir Path testFolder) throws IOException { + void cleanupRenamePdfRenamesFileStartingWithBibtexKey(@TempDir Path testFolder) throws IOException { Path path = testFolder.resolve("Toot.tmp"); Files.createFile(path); @@ -100,7 +98,7 @@ void cleanupRenamePdfRenamesFileStartingWithBibtexKey(@TempDirectory.TempDir Pat } @Test - void cleanupRenamePdfRenamesFileInSameFolder(@TempDirectory.TempDir Path testFolder) throws IOException { + void cleanupRenamePdfRenamesFileInSameFolder(@TempDir Path testFolder) throws IOException { Path path = testFolder.resolve("Toot.pdf"); Files.createFile(path); LinkedFile fileField = new LinkedFile("", "Toot.pdf", "PDF"); diff --git a/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java b/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java index 85051a17351..a1513a6ee9f 100644 --- a/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java +++ b/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java @@ -18,10 +18,9 @@ import org.jabref.model.util.DummyFileUpdateMonitor; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.junitpioneer.jupiter.TempDirectory; import org.mockito.Answers; import org.xmlunit.builder.Input; import org.xmlunit.builder.Input.Builder; @@ -32,7 +31,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class BibTeXMLExporterTestFiles { private static Path resourceDir; @@ -52,7 +50,7 @@ public static Stream fileNames() throws IOException, URISyntaxException } @BeforeEach - public void setUp(@TempDirectory.TempDir Path testFolder) throws Exception { + public void setUp(@TempDir Path testFolder) throws Exception { databaseContext = new BibDatabaseContext(); charset = StandardCharsets.UTF_8; bibtexmlExportFormat = new BibTeXMLExporter(); diff --git a/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java index a408b035221..1450f3d8295 100644 --- a/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java @@ -17,14 +17,12 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class CsvExportFormatTest { public BibDatabaseContext databaseContext; @@ -51,7 +49,7 @@ public void tearDown() { } @Test - public void testPerformExportForSingleAuthor(@TempDirectory.TempDir Path testFolder) throws Exception { + public void testPerformExportForSingleAuthor(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); BibEntry entry = new BibEntry(); @@ -68,7 +66,7 @@ public void testPerformExportForSingleAuthor(@TempDirectory.TempDir Path testFol } @Test - public void testPerformExportForMultipleAuthors(@TempDirectory.TempDir Path testFolder) throws Exception { + public void testPerformExportForMultipleAuthors(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); BibEntry entry = new BibEntry(); @@ -85,7 +83,7 @@ public void testPerformExportForMultipleAuthors(@TempDirectory.TempDir Path test } @Test - public void testPerformExportForSingleEditor(@TempDirectory.TempDir Path testFolder) throws Exception { + public void testPerformExportForSingleEditor(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); File tmpFile = path.toFile(); BibEntry entry = new BibEntry(); @@ -102,7 +100,7 @@ public void testPerformExportForSingleEditor(@TempDirectory.TempDir Path testFol } @Test - public void testPerformExportForMultipleEditors(@TempDirectory.TempDir Path testFolder) throws Exception { + public void testPerformExportForMultipleEditors(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); File tmpFile = path.toFile(); BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/exporter/DocBook5ExporterTest.java b/src/test/java/org/jabref/logic/exporter/DocBook5ExporterTest.java index a97c72ef463..cd0fa728187 100644 --- a/src/test/java/org/jabref/logic/exporter/DocBook5ExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/DocBook5ExporterTest.java @@ -20,8 +20,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import org.xmlunit.builder.Input; import org.xmlunit.builder.Input.Builder; @@ -32,7 +31,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class DocBook5ExporterTest { public BibDatabaseContext databaseContext; @@ -68,7 +66,7 @@ public void setUp() throws URISyntaxException { } @Test - public void testPerformExportForSingleEntry(@TempDirectory.TempDir Path testFolder) throws Exception { + public void testPerformExportForSingleEntry(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); diff --git a/src/test/java/org/jabref/logic/exporter/ExporterTest.java b/src/test/java/org/jabref/logic/exporter/ExporterTest.java index 67c7087f8da..ef33a47b167 100644 --- a/src/test/java/org/jabref/logic/exporter/ExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/ExporterTest.java @@ -16,16 +16,14 @@ import org.jabref.model.entry.BibEntry; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.junitpioneer.jupiter.TempDirectory; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class ExporterTest { public BibDatabaseContext databaseContext; @@ -56,7 +54,7 @@ private static Stream exportFormats() { @ParameterizedTest @MethodSource("exportFormats") - public void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, String name, @TempDirectory.TempDir Path testFolder) throws Exception { + public void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, String name, @TempDir Path testFolder) throws Exception { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); exportFormat.export(databaseContext, tmpFile, charset, entries); @@ -65,7 +63,7 @@ public void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, Str @ParameterizedTest @MethodSource("exportFormats") - public void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String name, @TempDirectory.TempDir Path testFolder) { + public void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String name, @TempDir Path testFolder) { assertThrows(NullPointerException.class, () -> { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); @@ -75,7 +73,7 @@ public void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String nam @ParameterizedTest @MethodSource("exportFormats") - public void testExportingNullEntriesThrowsNPE(Exporter exportFormat, String name, @TempDirectory.TempDir Path testFolder) { + public void testExportingNullEntriesThrowsNPE(Exporter exportFormat, String name, @TempDir Path testFolder) { assertThrows(NullPointerException.class, () -> { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); diff --git a/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java index 28067d99bde..3fa8628adba 100644 --- a/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java @@ -16,14 +16,12 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class HtmlExportFormatTest { public BibDatabaseContext databaseContext; public Charset charset; @@ -55,7 +53,7 @@ public void tearDown() { } @Test - public void emitWellFormedHtml(@TempDirectory.TempDir Path testFolder) throws Exception { + public void emitWellFormedHtml(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); exportFormat.export(databaseContext, path, charset, entries); List lines = Files.readAllLines(path); diff --git a/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java b/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java index e1de292326a..1a5da06af9b 100644 --- a/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java +++ b/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java @@ -18,10 +18,9 @@ import org.jabref.model.util.DummyFileUpdateMonitor; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.junitpioneer.jupiter.TempDirectory; import org.mockito.Answers; import org.xmlunit.builder.Input; import org.xmlunit.builder.Input.Builder; @@ -32,7 +31,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class MSBibExportFormatTestFiles { private static Path resourceDir; @@ -53,7 +51,7 @@ static Stream fileNames() throws IOException, URISyntaxException { } @BeforeEach - void setUp(@TempDirectory.TempDir Path testFolder) throws Exception { + void setUp(@TempDir Path testFolder) throws Exception { databaseContext = new BibDatabaseContext(); charset = StandardCharsets.UTF_8; msBibExportFormat = new MSBibExporter(); diff --git a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java index 2d797d4e8de..65ae6465295 100644 --- a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java @@ -14,14 +14,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class ModsExportFormatTest { public Charset charset; @@ -38,7 +36,7 @@ public void setUp() throws Exception { } @Test - public final void exportForNoEntriesWritesNothing(@TempDirectory.TempDir Path tempFile) throws Exception { + public final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { Path file = tempFile.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); modsExportFormat.export(databaseContext, tempFile, charset, Collections.emptyList()); diff --git a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java index 009c9f461ac..3834d7895d9 100644 --- a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java +++ b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java @@ -18,10 +18,9 @@ import org.jabref.model.util.DummyFileUpdateMonitor; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.junitpioneer.jupiter.TempDirectory; import org.mockito.Answers; import org.mockito.Mockito; import org.xmlunit.builder.Input; @@ -33,7 +32,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) public class ModsExportFormatTestFiles { private static Path resourceDir; @@ -57,7 +55,7 @@ public static Stream fileNames() throws Exception { } @BeforeEach - public void setUp(@TempDirectory.TempDir Path testFolder) throws Exception { + public void setUp(@TempDir Path testFolder) throws Exception { databaseContext = new BibDatabaseContext(); charset = StandardCharsets.UTF_8; modsExportFormat = new ModsExporter(); diff --git a/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java index 103d7c4996b..9ddbe119d73 100644 --- a/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java @@ -13,12 +13,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; -@ExtendWith(TempDirectory.class) public class MsBibExportFormatTest { public BibDatabaseContext databaseContext; @@ -33,7 +31,7 @@ public void setUp() throws Exception { } @Test - public final void testPerformExportWithNoEntry(@TempDirectory.TempDir Path tempFile) throws IOException, SaveException { + public final void testPerformExportWithNoEntry(@TempDir Path tempFile) throws IOException, SaveException { Path path = tempFile.resolve("ThisIsARandomlyNamedFile"); Files.createFile(path); List entries = Collections.emptyList(); diff --git a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java index d06fc91e374..d24b3725624 100644 --- a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java @@ -18,15 +18,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) public class XmpExporterTest { private Exporter exporter; @@ -48,7 +46,7 @@ public void setUp() { } @Test - public void exportSingleEntry(@TempDirectory.TempDir Path testFolder) throws Exception { + public void exportSingleEntry(@TempDir Path testFolder) throws Exception { Path file = testFolder.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); @@ -76,7 +74,7 @@ public void exportSingleEntry(@TempDirectory.TempDir Path testFolder) throws Exc } @Test - public void writeMultipleEntriesInASingleFile(@TempDirectory.TempDir Path testFolder) throws Exception { + public void writeMultipleEntriesInASingleFile(@TempDir Path testFolder) throws Exception { Path file = testFolder.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); @@ -128,7 +126,7 @@ public void writeMultipleEntriesInASingleFile(@TempDirectory.TempDir Path testFo } @Test - public void writeMultipleEntriesInDifferentFiles(@TempDirectory.TempDir Path testFolder) throws Exception { + public void writeMultipleEntriesInDifferentFiles(@TempDir Path testFolder) throws Exception { Path file = testFolder.resolve("split"); Files.createFile(file); @@ -194,7 +192,7 @@ public void writeMultipleEntriesInDifferentFiles(@TempDirectory.TempDir Path tes } @Test - public void exportSingleEntryWithPrivacyFilter(@TempDirectory.TempDir Path testFolder) throws Exception { + public void exportSingleEntryWithPrivacyFilter(@TempDir Path testFolder) throws Exception { when(xmpPreferences.getXmpPrivacyFilter()).thenReturn(Arrays.asList("author")); when(xmpPreferences.isUseXMPPrivacyFilter()).thenReturn(true); diff --git a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java index 54a1d715e99..8884604b67c 100644 --- a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java +++ b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java @@ -23,8 +23,7 @@ import org.jabref.model.metadata.MetaData; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Mockito; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -32,7 +31,6 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) class IntegrityCheckTest { @Test @@ -220,7 +218,7 @@ void testFileChecks() { } @Test - void fileCheckFindsFilesRelativeToBibFile(@TempDirectory.TempDir Path testFolder) throws IOException { + void fileCheckFindsFilesRelativeToBibFile(@TempDir Path testFolder) throws IOException { Path bibFile = testFolder.resolve("lit.bib"); Files.createFile(bibFile); Path pdfFile = testFolder.resolve("file.pdf"); diff --git a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java index c8fbdf7f7e6..54109db5c86 100644 --- a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java +++ b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java @@ -8,21 +8,19 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -@ExtendWith(TempDirectory.class) public class ProtectedTermsListTest { private ProtectedTermsList internalList; private ProtectedTermsList externalList; @BeforeEach - public void setUp(@TempDirectory.TempDir Path temporaryFolder) throws IOException { + public void setUp(@TempDir Path temporaryFolder) throws IOException { Path path = temporaryFolder.resolve("ThisIsARandomlyNamedFile"); Files.createFile(path); String tempFileName = path.toString(); diff --git a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java index 0cc24dc3b8a..b08c1c3546d 100644 --- a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java +++ b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java @@ -14,14 +14,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -@ExtendWith(TempDirectory.class) class ProtectedTermsLoaderTest { private ProtectedTermsLoader loader; @@ -166,7 +164,7 @@ void testDoNotLoadTheSameInternalListTwice() { } @Test - void testAddNewTermListAddsList(@TempDirectory.TempDir Path tempDir) { + void testAddNewTermListAddsList(@TempDir Path tempDir) { ProtectedTermsLoader localLoader = new ProtectedTermsLoader( new ProtectedTermsPreferences(Collections.emptyList(), Collections.emptyList(), @@ -176,7 +174,7 @@ void testAddNewTermListAddsList(@TempDirectory.TempDir Path tempDir) { } @Test - void testAddNewTermListNewListInList(@TempDirectory.TempDir Path tempDir) { + void testAddNewTermListNewListInList(@TempDir Path tempDir) { ProtectedTermsLoader localLoader = new ProtectedTermsLoader( new ProtectedTermsPreferences(Collections.emptyList(), Collections.emptyList(), @@ -187,7 +185,7 @@ void testAddNewTermListNewListInList(@TempDirectory.TempDir Path tempDir) { } @Test - void testRemoveTermList(@TempDirectory.TempDir Path tempDir) { + void testRemoveTermList(@TempDir Path tempDir) { ProtectedTermsLoader localLoader = new ProtectedTermsLoader( new ProtectedTermsPreferences(Collections.emptyList(), Collections.emptyList(), @@ -197,7 +195,7 @@ void testRemoveTermList(@TempDirectory.TempDir Path tempDir) { } @Test - void testRemoveTermListReduceTheCount(@TempDirectory.TempDir Path tempDir) { + void testRemoveTermListReduceTheCount(@TempDir Path tempDir) { ProtectedTermsLoader localLoader = new ProtectedTermsLoader( new ProtectedTermsPreferences(Collections.emptyList(), Collections.emptyList(), @@ -209,7 +207,7 @@ void testRemoveTermListReduceTheCount(@TempDirectory.TempDir Path tempDir) { } @Test - void testAddNewTermListSetsCorrectDescription(@TempDirectory.TempDir Path tempDir) { + void testAddNewTermListSetsCorrectDescription(@TempDir Path tempDir) { ProtectedTermsLoader localLoader = new ProtectedTermsLoader( new ProtectedTermsPreferences(Collections.emptyList(), Collections.emptyList(), diff --git a/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java b/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java index 70c8ea51941..67e5147665e 100644 --- a/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java +++ b/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java @@ -12,12 +12,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; -@ExtendWith(TempDirectory.class) class CiteKeyBasedFileFinderTest { private BibEntry entry; @@ -28,7 +26,7 @@ class CiteKeyBasedFileFinderTest { private Path pdfFile; @BeforeEach - void setUp(@TempDirectory.TempDir Path temporaryFolder) throws IOException { + void setUp(@TempDir Path temporaryFolder) throws IOException { entry = new BibEntry(BibtexEntryTypes.ARTICLE); entry.setCiteKey("HipKro03"); diff --git a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java index 4103e8b7d23..386ab268e08 100644 --- a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java @@ -18,8 +18,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -29,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; -@ExtendWith(TempDirectory.class) class FileUtilTest { private final Path nonExistingTestPath = Paths.get("nonExistingTestPath"); private Path existingTestFile; @@ -38,7 +36,7 @@ class FileUtilTest { private Path rootDir; @BeforeEach - void setUpViewModel(@TempDirectory.TempDir Path temporaryFolder) throws IOException { + void setUpViewModel(@TempDir Path temporaryFolder) throws IOException { rootDir = temporaryFolder; Path subDir = rootDir.resolve("1"); Files.createDirectory(subDir); @@ -322,7 +320,7 @@ void testRenameFileWithFromFileExistAndOtherToFileExist() { } @Test - void testRenameFileSuccessful(@TempDirectory.TempDir Path otherTemporaryFolder) { + void testRenameFileSuccessful(@TempDir Path otherTemporaryFolder) { // Be careful. This "otherTemporaryFolder" is the same as the "temporaryFolder" // in the @BeforeEach method. Path temp = Paths.get(otherTemporaryFolder.resolve("123").toString()); diff --git a/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java b/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java index f3d57c6bfae..4de6513ca4f 100644 --- a/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java +++ b/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java @@ -15,14 +15,12 @@ import org.apache.pdfbox.pdmodel.PDPage; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junitpioneer.jupiter.TempDirectory; +import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@ExtendWith(TempDirectory.class) class XmpUtilWriterTest { private static BibEntry olly2018; @@ -94,7 +92,7 @@ void setUp() { * Test for writing a PDF file with a single DublinCore metadata entry. */ @Test - void testWriteXmp(@TempDirectory.TempDir Path tempDir) throws IOException, TransformerException { + void testWriteXmp(@TempDir Path tempDir) throws IOException, TransformerException { Path pdfFile = this.createDefaultFile("JabRef_writeSingle.pdf", tempDir); @@ -118,7 +116,7 @@ void testWriteXmp(@TempDirectory.TempDir Path tempDir) throws IOException, Trans * Test, which writes multiple metadata entries to a PDF and reads them again to test the size. */ @Test - void testWriteMultipleBibEntries(@TempDirectory.TempDir Path tempDir) throws IOException, TransformerException { + void testWriteMultipleBibEntries(@TempDir Path tempDir) throws IOException, TransformerException { Path pdfFile = this.createDefaultFile("JabRef_writeMultiple.pdf", tempDir);