diff --git a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java index f720529388f..9e7da8f5a11 100644 --- a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java +++ b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java @@ -17,7 +17,6 @@ import javafx.scene.control.ButtonType; import org.jabref.gui.DialogService; -import org.jabref.gui.Globals; import org.jabref.gui.externalfiletype.ExternalFileType; import org.jabref.gui.externalfiletype.ExternalFileTypes; import org.jabref.gui.externalfiletype.StandardExternalFileType; @@ -65,7 +64,6 @@ class LinkedFileViewModelTest { private final ExternalFileTypes externalFileType = mock(ExternalFileTypes.class); private final FilePreferences filePreferences = mock(FilePreferences.class); private final XmpPreferences xmpPreferences = mock(XmpPreferences.class); - private final JabRefPreferences jabRefPreferences = mock(JabRefPreferences.class); private CookieManager cookieManager; @BeforeEach @@ -186,11 +184,8 @@ void deleteWhenDialogCancelledReturnsFalseAndDoesNotRemoveFile() { // Structure taken from deleteWhenDialogCancelledReturnsFalseAndDoesNotRemoveFile method @Test void downloadHtmlFileCausesWarningDisplay() throws MalformedURLException { - Globals.prefs = jabRefPreferences.getInstance(); // required for task execution - // From BibDatabaseContextTest::setUp when(filePreferences.shouldStoreFilesRelativeToBib()).thenReturn(true); - when(filePreferences.getFileNamePattern()).thenReturn("[citationkey]"); // used in other tests in this class when(filePreferences.getFileDirectoryPattern()).thenReturn("[entrytype]"); // used in movesFileWithFileDirPattern at MoveFilesCleanupTest.java @@ -233,10 +228,7 @@ void downloadHtmlWhenLinkedFilePointsToHtml() throws MalformedURLException { String fileType = StandardExternalFileType.URL.getName(); linkedFile = new LinkedFile(new URL(url), fileType); - Globals.prefs = jabRefPreferences.getInstance(); - when(filePreferences.shouldStoreFilesRelativeToBib()).thenReturn(true); - when(filePreferences.getFileNamePattern()).thenReturn("[citationkey]"); when(filePreferences.getFileDirectoryPattern()).thenReturn("[entrytype]"); @@ -284,18 +276,14 @@ void isSamePath() { // Tests if added parameters to mimeType gets parsed to correct format. @Test void mimeTypeStringWithParameterIsReturnedAsWithoutParameter() { - Globals.prefs = jabRefPreferences.getInstance(); // required for task execution - ExternalFileTypes externalFileTypesInstance = externalFileType.getInstance(); - Optional test = externalFileTypesInstance.getExternalFileTypeByMimeType("text/html; charset=UTF-8"); + Optional test = externalFileType.getExternalFileTypeByMimeType("text/html; charset=UTF-8"); String actual = test.get().toString(); assertEquals("URL", actual); } @Test void downloadPdfFileWhenLinkedFilePointsToPdfUrl() throws MalformedURLException { - Globals.prefs = jabRefPreferences.getInstance(); linkedFile = new LinkedFile(new URL("http://arxiv.org/pdf/1207.0408v1"), "pdf"); - // Needed Mockito stubbing methods to run test when(filePreferences.shouldStoreFilesRelativeToBib()).thenReturn(true); when(filePreferences.getFileNamePattern()).thenReturn("[citationkey]");