From bf9388b0313d3f71ad72205470df9b268cde1ef6 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Mon, 11 Nov 2024 22:22:33 +1100 Subject: [PATCH 01/39] Add method to check if file is image in LinkedFile.java --- src/main/java/org/jabref/model/entry/LinkedFile.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/jabref/model/entry/LinkedFile.java b/src/main/java/org/jabref/model/entry/LinkedFile.java index ec189fab2bf..0d8a8016532 100644 --- a/src/main/java/org/jabref/model/entry/LinkedFile.java +++ b/src/main/java/org/jabref/model/entry/LinkedFile.java @@ -8,6 +8,7 @@ import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -40,6 +41,8 @@ public class LinkedFile implements Serializable { private static final LinkedFile NULL_OBJECT = new LinkedFile("", Path.of(""), ""); + private static final List IMAGE_EXTENSIONS = new ArrayList<>(List.of("jpeg", "jpg", "png", "gif")); + // We have to mark these properties as transient because they can't be serialized directly private transient StringProperty description = new SimpleStringProperty(); private transient StringProperty link = new SimpleStringProperty(); @@ -220,6 +223,10 @@ public boolean isOnlineLink() { return isOnlineLink(link.get()); } + public boolean isImage() { + return IMAGE_EXTENSIONS.stream().anyMatch(getFileType().toLowerCase()::contains); + } + public Optional findIn(BibDatabaseContext databaseContext, FilePreferences filePreferences) { List dirs = databaseContext.getFileDirectories(filePreferences); return findIn(dirs); From 6aaa9af1981e9f0b4f56604dfab3a4cf3b03ac02 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Mon, 11 Nov 2024 22:23:44 +1100 Subject: [PATCH 02/39] Add method to retrieve cover image in BibEntry.java --- .../java/org/jabref/model/entry/BibEntry.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 6f2a38aca7c..b83e01585fb 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -775,6 +775,22 @@ public Optional getISBN() { return getField(StandardField.ISBN).flatMap(ISBN::parse); } + public String getPathToCoverImage() { + String path = ""; + + for (LinkedFile file : getFiles()) { + if (file.isImage()) { + path = "file:///" + file.getLink(); + if (file.getDescription().equalsIgnoreCase("cover")) { + path = "file:///" + file.getLink(); + break; + } + } + } + + return path; + } + /** * Will return the publication date of the given bibtex entry conforming to ISO 8601, i.e. either YYYY or YYYY-MM. * From aa64848ef2270a87b6a42c6aed3aa4dfca15f779 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Mon, 11 Nov 2024 22:34:51 +1100 Subject: [PATCH 03/39] Add HTML image for book cover to setPreviewText --- .../java/org/jabref/gui/preview/PreviewViewer.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 29d6ed72ea8..cc0cb0b45bc 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -81,6 +81,8 @@ function getSelectionHtml() { private PreviewLayout layout; private String layoutText; + private String bookCover; // TODO DAMIAN - consider making this Optional? + /** * @param database Used for resolving strings and pdf directories for links. */ @@ -183,6 +185,7 @@ private void update() { Number.serialExportNumber = 1; // Set entry number in case that is included in the preview layout. final BibEntry theEntry = entry.get(); + bookCover = theEntry.getPathToCoverImage(); BackgroundTask .wrap(() -> layout.generatePreview(theEntry, database)) .onSuccess(this::setPreviewText) @@ -205,10 +208,17 @@ private void setPreviewText(String text) { layoutText = """ -
%s
+
+
+ %s +
+
+ +
+
- """.formatted(text); + """.formatted(text, bookCover); highlightLayoutText(); this.setHvalue(0); } From b74e0221a854a82600997e92216f1871674f1836 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Mon, 11 Nov 2024 22:35:26 +1100 Subject: [PATCH 04/39] Remove unnecessary TODO --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index cc0cb0b45bc..33b1b85c211 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -81,7 +81,7 @@ function getSelectionHtml() { private PreviewLayout layout; private String layoutText; - private String bookCover; // TODO DAMIAN - consider making this Optional? + private String bookCover; /** * @param database Used for resolving strings and pdf directories for links. From 21002106616920db7a3344d005fe8be00e89069d Mon Sep 17 00:00:00 2001 From: Damian Gamlath Date: Tue, 12 Nov 2024 23:22:27 +1100 Subject: [PATCH 05/39] Check EntryType is a book or related item in BibEntry --- src/main/java/org/jabref/model/entry/BibEntry.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index b83e01585fb..7700a505c00 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -99,6 +99,9 @@ public class BibEntry implements Cloneable { public static final EntryType DEFAULT_TYPE = StandardEntryType.Misc; + private static final List COVERABLE_TYPES = List.of(StandardEntryType.Book, StandardEntryType.InBook, StandardEntryType.Booklet); + // TODO DAMIAN _ run style checker particularly ehre + private static final Logger LOGGER = LoggerFactory.getLogger(BibEntry.class); private final SharedBibEntryData sharedBibEntryData; @@ -778,9 +781,14 @@ public Optional getISBN() { public String getPathToCoverImage() { String path = ""; + + if (!isCoverable(this.type.get())) { + return ""; + } + for (LinkedFile file : getFiles()) { if (file.isImage()) { - path = "file:///" + file.getLink(); + path = "file:///" + file.getLink(); // TODO DAMIAN - is the LinkedFile link always a local file? if (file.getDescription().equalsIgnoreCase("cover")) { path = "file:///" + file.getLink(); break; @@ -791,6 +799,10 @@ public String getPathToCoverImage() { return path; } + private boolean isCoverable(EntryType type) { + return COVERABLE_TYPES.contains(type); + } + /** * Will return the publication date of the given bibtex entry conforming to ISO 8601, i.e. either YYYY or YYYY-MM. * From c89f3c8cc21a486dd1e99c1b89e486d5107a4997 Mon Sep 17 00:00:00 2001 From: Damian Gamlath Date: Tue, 12 Nov 2024 23:23:02 +1100 Subject: [PATCH 06/39] Fix book cover size too large in PreviewViewer --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 33b1b85c211..9b2e6382ade 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -213,7 +213,7 @@ private void setPreviewText(String text) { %s
- +
From d7c559bcded94f1810cba9adf5bfc8cd89652bf6 Mon Sep 17 00:00:00 2001 From: Damian Gamlath Date: Tue, 12 Nov 2024 23:25:27 +1100 Subject: [PATCH 07/39] Refactor locations of methods in BibEntry --- .../org/jabref/gui/preview/PreviewViewer.java | 2 +- .../java/org/jabref/model/entry/BibEntry.java | 49 +++++++++---------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 9b2e6382ade..4af892eb136 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -185,7 +185,7 @@ private void update() { Number.serialExportNumber = 1; // Set entry number in case that is included in the preview layout. final BibEntry theEntry = entry.get(); - bookCover = theEntry.getPathToCoverImage(); + bookCover = theEntry.getCoverImageFilePath(); BackgroundTask .wrap(() -> layout.generatePreview(theEntry, database)) .onSuccess(this::setPreviewText) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 7700a505c00..9f3e6b8584f 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -778,31 +778,6 @@ public Optional getISBN() { return getField(StandardField.ISBN).flatMap(ISBN::parse); } - public String getPathToCoverImage() { - String path = ""; - - - if (!isCoverable(this.type.get())) { - return ""; - } - - for (LinkedFile file : getFiles()) { - if (file.isImage()) { - path = "file:///" + file.getLink(); // TODO DAMIAN - is the LinkedFile link always a local file? - if (file.getDescription().equalsIgnoreCase("cover")) { - path = "file:///" + file.getLink(); - break; - } - } - } - - return path; - } - - private boolean isCoverable(EntryType type) { - return COVERABLE_TYPES.contains(type); - } - /** * Will return the publication date of the given bibtex entry conforming to ISO 8601, i.e. either YYYY or YYYY-MM. * @@ -1152,6 +1127,26 @@ public Optional addFiles(List filesToAdd) { currentFiles.addAll(filesToAdd); return setFiles(currentFiles); } + + public String getCoverImageFilePath() { + String path = ""; + + if (!isCoverable(this.type.get())) { + return ""; + } + + for (LinkedFile file : getFiles()) { + if (file.isImage()) { + path = "file:///" + file.getLink(); // TODO DAMIAN - is the LinkedFile link always a local file? + if (file.getDescription().equalsIgnoreCase("cover")) { + path = "file:///" + file.getLink(); + break; + } + } + } + + return path; + } // endregion /** @@ -1281,4 +1276,8 @@ public boolean isEmpty() { } return StandardField.AUTOMATIC_FIELDS.containsAll(this.getFields()); } + + private boolean isCoverable(EntryType type) { + return COVERABLE_TYPES.contains(type); + } } From 7c8212362c1b2fdc39e1d42f920e7eb8d59c44f4 Mon Sep 17 00:00:00 2001 From: Damian Gamlath Date: Tue, 12 Nov 2024 23:44:36 +1100 Subject: [PATCH 08/39] Remove todo comments. Add comments. --- .../java/org/jabref/model/entry/BibEntry.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 9f3e6b8584f..f3a9e60a3d0 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -100,7 +100,6 @@ public class BibEntry implements Cloneable { public static final EntryType DEFAULT_TYPE = StandardEntryType.Misc; private static final List COVERABLE_TYPES = List.of(StandardEntryType.Book, StandardEntryType.InBook, StandardEntryType.Booklet); - // TODO DAMIAN _ run style checker particularly ehre private static final Logger LOGGER = LoggerFactory.getLogger(BibEntry.class); private final SharedBibEntryData sharedBibEntryData; @@ -1128,16 +1127,20 @@ public Optional addFiles(List filesToAdd) { return setFiles(currentFiles); } + /** + * @return String - "file:///" + path to a cover image from LinkedFiles + * and the BibEntry is a Book or other COVERABLE_TYPES + */ public String getCoverImageFilePath() { String path = ""; - if (!isCoverable(this.type.get())) { + if (!isCoverable()) { return ""; } for (LinkedFile file : getFiles()) { if (file.isImage()) { - path = "file:///" + file.getLink(); // TODO DAMIAN - is the LinkedFile link always a local file? + path = "file:///" + file.getLink(); if (file.getDescription().equalsIgnoreCase("cover")) { path = "file:///" + file.getLink(); break; @@ -1277,7 +1280,10 @@ public boolean isEmpty() { return StandardField.AUTOMATIC_FIELDS.containsAll(this.getFields()); } - private boolean isCoverable(EntryType type) { - return COVERABLE_TYPES.contains(type); + /** + * @return true if this entry's type is a Book or one of COVERABLE_TYPES + */ + private boolean isCoverable() { + return COVERABLE_TYPES.contains(this.type.get()); } } From fd3750a5733fb251ce2cedf3ec8970e8e2b4ba67 Mon Sep 17 00:00:00 2001 From: Damian Gamlath Date: Wed, 13 Nov 2024 14:54:27 +1100 Subject: [PATCH 09/39] Add todo comments for testing new methods --- .../java/org/jabref/model/entry/BibEntryTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index 3d87ba15c48..6ee74650d98 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -267,6 +267,19 @@ void replaceOfLinkWorks() throws Exception { assertEquals(List.of(linkedFile), entry.getFiles()); } + @Test + void getCoverImagePathStringReturnsLinkToImageFile() { + LinkedFile image = new LinkedFile("", "png", "resources/images/external/JabRef-icon-128.png"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(new LinkedFile("", "", "")); + System.out.println(image); + } + + // TODO DAMIAN write tests for the following: + // only an image should be used as cover image + // an image with "cover" tag should be given preference + // check that only COVERABLE TYPES will return a valid string + @Test void getEmptyKeywords() { KeywordList actual = entry.getKeywords(','); From 0e04bbf73549cc01ba5a1875e1167eaed55a749f Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Wed, 13 Nov 2024 22:59:09 +1100 Subject: [PATCH 10/39] Refactor BibEntry to return cover image file instead of path --- .../java/org/jabref/model/entry/BibEntry.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index f3a9e60a3d0..02ecdb955d9 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -21,6 +21,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.swing.text.html.Option; + import javafx.beans.Observable; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -1128,27 +1130,26 @@ public Optional addFiles(List filesToAdd) { } /** - * @return String - "file:///" + path to a cover image from LinkedFiles - * and the BibEntry is a Book or other COVERABLE_TYPES + * @return LinkedFile that contains the cover image + * if the BibEntry is a Book or other COVERABLE_TYPES */ - public String getCoverImageFilePath() { - String path = ""; - + public Optional getCoverImageFile() { if (!isCoverable()) { - return ""; + return Optional.empty(); } + Optional output = Optional.empty(); + for (LinkedFile file : getFiles()) { if (file.isImage()) { - path = "file:///" + file.getLink(); - if (file.getDescription().equalsIgnoreCase("cover")) { - path = "file:///" + file.getLink(); - break; + output = Optional.of(file); + if (file.getDescription().equalsIgnoreCase("cover")) { // TODO DAMIAN - move to a final field + return output; } } } - return path; + return output; } // endregion From 5e9d764fe762ba603b026f780e51b8bcd65c1dc2 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Wed, 13 Nov 2024 22:59:43 +1100 Subject: [PATCH 11/39] Refactor PreviewViewer to receive cover file from BibEntry and convert to URI --- .../java/org/jabref/gui/preview/PreviewViewer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 4af892eb136..27280c5f304 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -30,6 +30,7 @@ import org.jabref.logic.util.WebViewStore; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; +import org.jabref.model.entry.LinkedFile; import org.jabref.model.search.query.SearchQuery; import com.airhacks.afterburner.injection.Injector; @@ -185,7 +186,6 @@ private void update() { Number.serialExportNumber = 1; // Set entry number in case that is included in the preview layout. final BibEntry theEntry = entry.get(); - bookCover = theEntry.getCoverImageFilePath(); BackgroundTask .wrap(() -> layout.generatePreview(theEntry, database)) .onSuccess(this::setPreviewText) @@ -218,11 +218,18 @@ private void setPreviewText(String text) { - """.formatted(text, bookCover); + """.formatted(text, getBookCoverURI()); highlightLayoutText(); this.setHvalue(0); } + private String getBookCoverURI() { + return entry + .flatMap(e -> e.getCoverImageFile() + .map(file -> "file:///" + file.getLink())) + .orElse(""); + } + private void highlightLayoutText() { if (layoutText == null) { return; From 0f0d2faf78667e53bec39d58570ddeeaae72c49d Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 14 Nov 2024 16:19:40 +1100 Subject: [PATCH 12/39] Add tests for getCoverImageFile method in BibEntry --- .../org/jabref/model/entry/BibEntryTest.java | 82 ++++++++++++++++--- 1 file changed, 69 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index 6ee74650d98..e4d3d636f4f 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -2,6 +2,7 @@ import java.net.URI; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -267,19 +268,6 @@ void replaceOfLinkWorks() throws Exception { assertEquals(List.of(linkedFile), entry.getFiles()); } - @Test - void getCoverImagePathStringReturnsLinkToImageFile() { - LinkedFile image = new LinkedFile("", "png", "resources/images/external/JabRef-icon-128.png"); - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.addFile(new LinkedFile("", "", "")); - System.out.println(image); - } - - // TODO DAMIAN write tests for the following: - // only an image should be used as cover image - // an image with "cover" tag should be given preference - // check that only COVERABLE TYPES will return a valid string - @Test void getEmptyKeywords() { KeywordList actual = entry.getKeywords(','); @@ -826,6 +814,74 @@ void mergeEntriesWithOverlapAndPriorityGivenToOverlappingField() { assertEquals(expected.getFields(), copyEntry.getFields()); } + @Test + void getCoverImageReturnsEmptyIfNoFiles() { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @Test + void getCoverImageReturnsEmptyIfNoImageFiles() { + LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); + LinkedFile markdown = new LinkedFile("", "readme.md", "md"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(markdown); + entry.addFile(pdf); + + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @Test + void getCoverImageReturnsEmptyIfEntryIsNotCoverableType() { + LinkedFile image = new LinkedFile("", Paths.get("JabRef-icon-128.png").toAbsolutePath().toString(), "png"); + entry = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "value"); + + entry.addFile(image); + + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @Test + void getCoverImageReturnsImageFileNotDocuments() { + LinkedFile image = new LinkedFile("", Paths.get("JabRef-icon-128.png").toAbsolutePath().toString(), "png"); + LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); + LinkedFile markdown = new LinkedFile("", "readme.md", "md"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(image); + entry.addFile(pdf); + entry.addFile(markdown); + + assertEquals(Optional.of(image), entry.getCoverImageFile()); + } + + @Test + void getCoverImagePrefersImageWithCoverTag() { + LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"); + LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"); + LinkedFile cover3 = new LinkedFile("cover", Paths.get("JabRef-icon-32.png"), "png"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(cover1); + entry.addFile(cover2); + entry.addFile(cover3); + + assertEquals(Optional.of(cover3), entry.getCoverImageFile()); + } + + @Test + void getCoverImageDoesntReturnDocumentWithCoverTag() { + LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf"), "pdf"); + LinkedFile md = new LinkedFile("cover", Paths.get("readme.md"), "md"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(pdf); + entry.addFile(md); + + assertNotEquals(Optional.of(md), entry.getCoverImageFile()); + } + public static Stream isEmpty() { return Stream.of( new BibEntry(), From ab2d3abc6f3e9ba11677ae20092153bfb4287e35 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 14 Nov 2024 16:21:36 +1100 Subject: [PATCH 13/39] Change cover string to a static field --- src/main/java/org/jabref/model/entry/BibEntry.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 02ecdb955d9..b3b4d31035f 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -101,7 +101,9 @@ public class BibEntry implements Cloneable { public static final EntryType DEFAULT_TYPE = StandardEntryType.Misc; + private static final List COVERABLE_TYPES = List.of(StandardEntryType.Book, StandardEntryType.InBook, StandardEntryType.Booklet); + private static final String COVER_TAG = "cover"; private static final Logger LOGGER = LoggerFactory.getLogger(BibEntry.class); private final SharedBibEntryData sharedBibEntryData; @@ -1143,7 +1145,7 @@ public Optional getCoverImageFile() { for (LinkedFile file : getFiles()) { if (file.isImage()) { output = Optional.of(file); - if (file.getDescription().equalsIgnoreCase("cover")) { // TODO DAMIAN - move to a final field + if (file.getDescription().equalsIgnoreCase(COVER_TAG)) { return output; } } From da906f7fe92ca125c965afb8ee602c667b41813f Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Fri, 15 Nov 2024 15:07:51 +1100 Subject: [PATCH 14/39] Align book cover to right side in PreviewViewer setPreviewText --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 27280c5f304..d25884bc0ab 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -213,7 +213,7 @@ private void setPreviewText(String text) { %s
- +
From eb06002093cf2a7bfe3fd1339a79497fd4d5cf79 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 16 Nov 2024 08:48:44 +1100 Subject: [PATCH 15/39] Fix checkstyle issues --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index d25884bc0ab..624cfd3097d 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -30,7 +30,6 @@ import org.jabref.logic.util.WebViewStore; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.LinkedFile; import org.jabref.model.search.query.SearchQuery; import com.airhacks.afterburner.injection.Injector; @@ -82,8 +81,6 @@ function getSelectionHtml() { private PreviewLayout layout; private String layoutText; - private String bookCover; - /** * @param database Used for resolving strings and pdf directories for links. */ From 23c04d52a3f9a163f898e677dbabe0d6b5c04033 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 16 Nov 2024 23:14:50 +1100 Subject: [PATCH 16/39] Make getCoverImageFile only return image with "cover" in the description. Add tests for this. --- .../java/org/jabref/model/entry/BibEntry.java | 17 +++---- .../org/jabref/model/entry/BibEntryTest.java | 51 ++++++++++--------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index b3b4d31035f..f6fde23ac12 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -21,8 +21,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.swing.text.html.Option; - import javafx.beans.Observable; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -57,6 +55,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import scala.annotation.meta.field; /** * Represents a Bib(La)TeX entry, which can be BibTeX or BibLaTeX. @@ -1140,18 +1139,15 @@ public Optional getCoverImageFile() { return Optional.empty(); } - Optional output = Optional.empty(); - for (LinkedFile file : getFiles()) { - if (file.isImage()) { - output = Optional.of(file); - if (file.getDescription().equalsIgnoreCase(COVER_TAG)) { - return output; + if (file.getDescription().equalsIgnoreCase(COVER_TAG)) { + if (file.isImage()) { + return Optional.of(file); } } } - return output; + return Optional.empty(); } // endregion @@ -1185,7 +1181,8 @@ public Optional getMonth() { return getFieldOrAlias(StandardField.MONTH).flatMap(Month::parse); } - public OptionalBinding getFieldBinding(Field field) { + public OptionalBinding getFieldBinding(Field + field) { if ((field == InternalField.TYPE_HEADER) || (field == InternalField.OBSOLETE_TYPE_HEADER)) { return EasyBind.wrapNullable(type).mapOpt(EntryType::getDisplayName); } diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index e4d3d636f4f..b1c5c51a159 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -833,46 +833,36 @@ void getCoverImageReturnsEmptyIfNoImageFiles() { } @Test - void getCoverImageReturnsEmptyIfEntryIsNotCoverableType() { - LinkedFile image = new LinkedFile("", Paths.get("JabRef-icon-128.png").toAbsolutePath().toString(), "png"); - entry = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "value"); - - entry.addFile(image); - + void getCoverImageReturnsEmptyIfEntryIsNotCoverable() { + entry = new BibEntry(StandardEntryType.Proceedings).withField(StandardField.AUTHOR, "value"); assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - @Test - void getCoverImageReturnsImageFileNotDocuments() { - LinkedFile image = new LinkedFile("", Paths.get("JabRef-icon-128.png").toAbsolutePath().toString(), "png"); - LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); - LinkedFile markdown = new LinkedFile("", "readme.md", "md"); - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - - entry.addFile(image); - entry.addFile(pdf); - entry.addFile(markdown); + entry = new BibEntry(StandardEntryType.Dataset).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); - assertEquals(Optional.of(image), entry.getCoverImageFile()); + entry = new BibEntry(StandardEntryType.Software).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); } @Test - void getCoverImagePrefersImageWithCoverTag() { + void getCoverImageDoesNotReturnImagesWithoutCoverDescription() { LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"); LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"); - LinkedFile cover3 = new LinkedFile("cover", Paths.get("JabRef-icon-32.png"), "png"); + LinkedFile cover3 = new LinkedFile("", Paths.get("JabRef-icon-32.png"), "png"); entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); entry.addFile(cover1); entry.addFile(cover2); entry.addFile(cover3); - assertEquals(Optional.of(cover3), entry.getCoverImageFile()); + assertNotEquals(Optional.of(cover1), entry.getCoverImageFile()); + assertNotEquals(Optional.of(cover2), entry.getCoverImageFile()); + assertNotEquals(Optional.of(cover3), entry.getCoverImageFile()); } @Test - void getCoverImageDoesntReturnDocumentWithCoverTag() { - LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf"), "pdf"); + void getCoverImageDoesNotReturnDocumentsWithCoverDescription() { + LinkedFile pdf = new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"); LinkedFile md = new LinkedFile("cover", Paths.get("readme.md"), "md"); entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); @@ -880,6 +870,21 @@ void getCoverImageDoesntReturnDocumentWithCoverTag() { entry.addFile(md); assertNotEquals(Optional.of(md), entry.getCoverImageFile()); + assertNotEquals(Optional.of(pdf), entry.getCoverImageFile()); + } + + @Test + void getCoverImageReturnsCorrectImage() { + LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"); + LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"); + LinkedFile cover3 = new LinkedFile("cover", Paths.get("JabRef-icon-32.png"), "png"); + BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(cover1); + entry.addFile(cover2); + entry.addFile(cover3); + + assertEquals(Optional.of(cover3), entry.getCoverImageFile()); } public static Stream isEmpty() { From c902323d62779eb490b54f4140a91620bb28c59e Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 16 Nov 2024 23:31:39 +1100 Subject: [PATCH 17/39] Fix poor cover image resizing --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 624cfd3097d..ae7c745acfe 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -210,7 +210,7 @@ private void setPreviewText(String text) { %s
- +
From 6b789f5fc6b33ca23a9011895fd4a83d81156842 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sun, 17 Nov 2024 16:35:38 +1100 Subject: [PATCH 18/39] Add test for getCoverImage in BibEntryTest.java --- .../org/jabref/model/entry/BibEntryTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index b1c5c51a159..1fe0c69d12d 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -887,6 +887,27 @@ void getCoverImageReturnsCorrectImage() { assertEquals(Optional.of(cover3), entry.getCoverImageFile()); } + @Test + void getCoverImageUpdatesWithChangeToDescription() { + List files = new ArrayList<>(); + + files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "png")); + files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png")); + LinkedFile cover1 = files.get(0); + LinkedFile cover2 = files.get(1); + + BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.setFiles(files); + + assertEquals(Optional.of(cover1), entry.getCoverImageFile()); + + cover1.setDescription(""); + cover2.setDescription("cover"); + entry.setFiles(files); + + assertEquals(Optional.of(cover2), entry.getCoverImageFile()); + } + public static Stream isEmpty() { return Stream.of( new BibEntry(), From 34647c86552d2d24b2fe1126c52d3fafa8d88384 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sun, 17 Nov 2024 22:18:58 +1100 Subject: [PATCH 19/39] Fix cover image not being displayed when its title has spaces --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index ae7c745acfe..aab71f99cd1 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -210,7 +210,7 @@ private void setPreviewText(String text) { %s
- +
@@ -221,10 +221,13 @@ private void setPreviewText(String text) { } private String getBookCoverURI() { - return entry + String output = entry .flatMap(e -> e.getCoverImageFile() .map(file -> "file:///" + file.getLink())) .orElse(""); + + System.out.println(output); + return output; } private void highlightLayoutText() { From 42ac2c9f4389a1b6b5f5fb9e965713b194f16d4c Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sun, 17 Nov 2024 22:21:37 +1100 Subject: [PATCH 20/39] Refactor getBookCoverURI in PreviewViewer --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index aab71f99cd1..12b4354071f 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -221,13 +221,10 @@ private void setPreviewText(String text) { } private String getBookCoverURI() { - String output = entry + return entry .flatMap(e -> e.getCoverImageFile() .map(file -> "file:///" + file.getLink())) .orElse(""); - - System.out.println(output); - return output; } private void highlightLayoutText() { From a9c5dbd0ac5573c977f2d47cc60f32ef5dc61d93 Mon Sep 17 00:00:00 2001 From: damgam0288 <94230112+damgam0288@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:10:27 +1100 Subject: [PATCH 21/39] Update Changelog for book cover feature issue 10120 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2921d7cc0dd..986bfcfd539 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added a search bar for filtering keyboard shortcuts. [#11686](https://github.com/JabRef/jabref/issues/11686) - By double clicking on a local citation in the Citation Relations Tab you can now jump the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955) - We use the menu icon for background tasks as a progress indicator to visualise an import's progress when dragging and dropping several PDF files into the main table. [#12072](https://github.com/JabRef/jabref/pull/12072) +- We added the ability for users to display a cover image in the preview panel of the entry editor for book, in-book and booklet citations [#10120](https://github.com/JabRef/jabref/issues/10120) ### Changed From 4119b7dafed86d4ce6f2d9085ef5a78995b6b6f7 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Mon, 18 Nov 2024 22:55:11 +1100 Subject: [PATCH 22/39] Fix CI tests failure: change getBookCoverURI --- .../java/org/jabref/gui/preview/PreviewViewer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 12b4354071f..ca21a5fb94e 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -221,10 +221,14 @@ private void setPreviewText(String text) { } private String getBookCoverURI() { - return entry - .flatMap(e -> e.getCoverImageFile() - .map(file -> "file:///" + file.getLink())) - .orElse(""); + if (entry.isPresent()) { + BibEntry theEntry = entry.get(); + if (theEntry.getCoverImageFile().isPresent()) { + return "file:///" + theEntry.getCoverImageFile().get().getLink(); + } + } + + return ""; } private void highlightLayoutText() { From 871fcaadf3249a8a9e6e59a9e3d425c53d01364c Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Mon, 18 Nov 2024 23:01:46 +1100 Subject: [PATCH 23/39] Fix CI tests failure: handle entry field null value --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 64683bf9a5b..25d7b983b2e 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -234,10 +234,9 @@ private void setPreviewText(String text) { } private String getBookCoverURI() { - if (entry.isPresent()) { - BibEntry theEntry = entry.get(); - if (theEntry.getCoverImageFile().isPresent()) { - return "file:///" + theEntry.getCoverImageFile().get().getLink(); + if (entry != null) { + if (entry.getCoverImageFile().isPresent()) { + return "file:///" + entry.getCoverImageFile().get().getLink(); } } From a7e9b107d2af3074e426aec965ec7d416c71c422 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 21 Nov 2024 22:00:30 +1100 Subject: [PATCH 24/39] Revise getCoverImage tests to use parameterization. --- .../org/jabref/model/entry/BibEntryTest.java | 65 ++++++++++--------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index 1fe0c69d12d..c37bd4b7580 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -832,45 +832,52 @@ void getCoverImageReturnsEmptyIfNoImageFiles() { assertEquals(Optional.empty(), entry.getCoverImageFile()); } - @Test - void getCoverImageReturnsEmptyIfEntryIsNotCoverable() { - entry = new BibEntry(StandardEntryType.Proceedings).withField(StandardField.AUTHOR, "value"); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - - entry = new BibEntry(StandardEntryType.Dataset).withField(StandardField.AUTHOR, "value"); + @ParameterizedTest + @MethodSource("nonCoverableEntryTypes") + void getCoverImageReturnsEmptyIfEntryIsNotCoverable(StandardEntryType entryType) { + BibEntry entry = new BibEntry(entryType).withField(StandardField.AUTHOR, "value"); assertEquals(Optional.empty(), entry.getCoverImageFile()); + } - entry = new BibEntry(StandardEntryType.Software).withField(StandardField.AUTHOR, "value"); - assertEquals(Optional.empty(), entry.getCoverImageFile()); + static Stream nonCoverableEntryTypes() { + return Stream.of( + StandardEntryType.Proceedings, + StandardEntryType.Dataset, + StandardEntryType.Software + ); } - @Test - void getCoverImageDoesNotReturnImagesWithoutCoverDescription() { - LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"); - LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"); - LinkedFile cover3 = new LinkedFile("", Paths.get("JabRef-icon-32.png"), "png"); + @ParameterizedTest + @MethodSource("imagesWithoutCoverDescription") + void getCoverImageDoesNotReturnImagesWithoutCoverDescription(LinkedFile image) { entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(image); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } - entry.addFile(cover1); - entry.addFile(cover2); - entry.addFile(cover3); - - assertNotEquals(Optional.of(cover1), entry.getCoverImageFile()); - assertNotEquals(Optional.of(cover2), entry.getCoverImageFile()); - assertNotEquals(Optional.of(cover3), entry.getCoverImageFile()); + static Stream imagesWithoutCoverDescription() { + return Stream.of( + new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"), + new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"), + new LinkedFile("", Paths.get("JabRef-icon-32.png"), "png") + ); } - @Test - void getCoverImageDoesNotReturnDocumentsWithCoverDescription() { - LinkedFile pdf = new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"); - LinkedFile md = new LinkedFile("cover", Paths.get("readme.md"), "md"); + @ParameterizedTest + @MethodSource("docsWithCoverDescription") + void getCoverImageDoesNotReturnDocumentsWithCoverDescription(LinkedFile file) { entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(file); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } - entry.addFile(pdf); - entry.addFile(md); - - assertNotEquals(Optional.of(md), entry.getCoverImageFile()); - assertNotEquals(Optional.of(pdf), entry.getCoverImageFile()); + static Stream docsWithCoverDescription() { + return Stream.of( + new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"), + new LinkedFile("cover", Paths.get("readme.md"), "md"), + new LinkedFile("cover", Paths.get("BiblioscapeImporterTestArticleST.txt"), "txt"), + new LinkedFile("cover", Paths.get("emptyFile.xml"), "xml") + ); } @Test From 2cf00f3c0e563657c340844106dafb3a1f7f6a7b Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 21 Nov 2024 22:01:56 +1100 Subject: [PATCH 25/39] Revise Image_Extensions to use HashSet of StandardExternalFileTypes enum --- .../java/org/jabref/model/entry/LinkedFile.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/LinkedFile.java b/src/main/java/org/jabref/model/entry/LinkedFile.java index 0d8a8016532..fad3d730f5a 100644 --- a/src/main/java/org/jabref/model/entry/LinkedFile.java +++ b/src/main/java/org/jabref/model/entry/LinkedFile.java @@ -8,7 +8,7 @@ import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; -import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -19,6 +19,7 @@ import javafx.beans.property.StringProperty; import org.jabref.architecture.AllowedToUseLogic; +import org.jabref.gui.externalfiletype.StandardExternalFileType; import org.jabref.logic.FilePreferences; import org.jabref.logic.util.FileType; import org.jabref.logic.util.io.FileUtil; @@ -39,9 +40,14 @@ public class LinkedFile implements Serializable { private static final String REGEX_URL = "^((?:https?\\:\\/\\/|www\\.)(?:[-a-z0-9]+\\.)*[-a-z0-9]+.*)"; private static final Pattern URL_PATTERN = Pattern.compile(REGEX_URL); - private static final LinkedFile NULL_OBJECT = new LinkedFile("", Path.of(""), ""); + private static final HashSet IMAGE_EXTENSIONS = new HashSet<>(); + static { + IMAGE_EXTENSIONS.add(StandardExternalFileType.JPG.getExtension()); + IMAGE_EXTENSIONS.add(StandardExternalFileType.PNG.getExtension()); + IMAGE_EXTENSIONS.add(StandardExternalFileType.GIF.getExtension()); + } - private static final List IMAGE_EXTENSIONS = new ArrayList<>(List.of("jpeg", "jpg", "png", "gif")); + private static final LinkedFile NULL_OBJECT = new LinkedFile("", Path.of(""), ""); // We have to mark these properties as transient because they can't be serialized directly private transient StringProperty description = new SimpleStringProperty(); @@ -224,7 +230,7 @@ public boolean isOnlineLink() { } public boolean isImage() { - return IMAGE_EXTENSIONS.stream().anyMatch(getFileType().toLowerCase()::contains); + return IMAGE_EXTENSIONS.contains(fileTypeProperty().getValue()); } public Optional findIn(BibDatabaseContext databaseContext, FilePreferences filePreferences) { From 28a762da79d04cc8c1af6a806c58a862e7d98a98 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 21 Nov 2024 22:03:43 +1100 Subject: [PATCH 26/39] Reword CHANGELOG.md. Remove wrong import BibEntry.java --- CHANGELOG.md | 2 +- src/main/java/org/jabref/model/entry/BibEntry.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2850e5097..910f72880be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added a search bar for filtering keyboard shortcuts. [#11686](https://github.com/JabRef/jabref/issues/11686) - By double clicking on a local citation in the Citation Relations Tab you can now jump the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955) - We use the menu icon for background tasks as a progress indicator to visualise an import's progress when dragging and dropping several PDF files into the main table. [#12072](https://github.com/JabRef/jabref/pull/12072) -- We added the ability for users to display a cover image in the preview panel of the entry editor for book, in-book and booklet citations [#10120](https://github.com/JabRef/jabref/issues/10120) +- We added the ability for users to display a cover image in the preview panel of the entry editor for book, in-book and booklet citations. [#10120](https://github.com/JabRef/jabref/issues/10120) ### Changed diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index f6fde23ac12..9d4f9e97d0e 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -55,7 +55,6 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import scala.annotation.meta.field; /** * Represents a Bib(La)TeX entry, which can be BibTeX or BibLaTeX. @@ -1181,8 +1180,7 @@ public Optional getMonth() { return getFieldOrAlias(StandardField.MONTH).flatMap(Month::parse); } - public OptionalBinding getFieldBinding(Field - field) { + public OptionalBinding getFieldBinding(Field field) { if ((field == InternalField.TYPE_HEADER) || (field == InternalField.OBSOLETE_TYPE_HEADER)) { return EasyBind.wrapNullable(type).mapOpt(EntryType::getDisplayName); } From 23a691f50ec02adf2f07b152fd450eeeed400081 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 21 Nov 2024 23:56:40 +1100 Subject: [PATCH 27/39] Revise LinkedFile.isImage to check for keyword "image" instead of checking extensions --- .../java/org/jabref/model/entry/LinkedFile.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/LinkedFile.java b/src/main/java/org/jabref/model/entry/LinkedFile.java index fad3d730f5a..cd7167cc6d2 100644 --- a/src/main/java/org/jabref/model/entry/LinkedFile.java +++ b/src/main/java/org/jabref/model/entry/LinkedFile.java @@ -8,7 +8,6 @@ import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; -import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -19,7 +18,6 @@ import javafx.beans.property.StringProperty; import org.jabref.architecture.AllowedToUseLogic; -import org.jabref.gui.externalfiletype.StandardExternalFileType; import org.jabref.logic.FilePreferences; import org.jabref.logic.util.FileType; import org.jabref.logic.util.io.FileUtil; @@ -40,13 +38,6 @@ public class LinkedFile implements Serializable { private static final String REGEX_URL = "^((?:https?\\:\\/\\/|www\\.)(?:[-a-z0-9]+\\.)*[-a-z0-9]+.*)"; private static final Pattern URL_PATTERN = Pattern.compile(REGEX_URL); - private static final HashSet IMAGE_EXTENSIONS = new HashSet<>(); - static { - IMAGE_EXTENSIONS.add(StandardExternalFileType.JPG.getExtension()); - IMAGE_EXTENSIONS.add(StandardExternalFileType.PNG.getExtension()); - IMAGE_EXTENSIONS.add(StandardExternalFileType.GIF.getExtension()); - } - private static final LinkedFile NULL_OBJECT = new LinkedFile("", Path.of(""), ""); // We have to mark these properties as transient because they can't be serialized directly @@ -229,8 +220,12 @@ public boolean isOnlineLink() { return isOnlineLink(link.get()); } + /** + * @return true if fileType contains the string "image" + */ public boolean isImage() { - return IMAGE_EXTENSIONS.contains(fileTypeProperty().getValue()); + // Cannot compare fileType to StandardExternalFileType enum since it is a StringProperty + return getFileType().toLowerCase().contains("image"); } public Optional findIn(BibDatabaseContext databaseContext, FilePreferences filePreferences) { From b1b39d7e6fe334874dae4cf59bb0196bfbfa1b11 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Thu, 21 Nov 2024 23:59:24 +1100 Subject: [PATCH 28/39] Revise BibEntryTest.java with correct "filetypes" for getCoverImage tests --- .../org/jabref/model/entry/BibEntryTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index c37bd4b7580..b43e6f5c1c0 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -857,9 +857,9 @@ void getCoverImageDoesNotReturnImagesWithoutCoverDescription(LinkedFile image) { static Stream imagesWithoutCoverDescription() { return Stream.of( - new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"), - new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"), - new LinkedFile("", Paths.get("JabRef-icon-32.png"), "png") + new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"), + new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"), + new LinkedFile("", Paths.get("JabRef-icon-32.png"), "PNG image") ); } @@ -882,9 +882,9 @@ static Stream docsWithCoverDescription() { @Test void getCoverImageReturnsCorrectImage() { - LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "png"); - LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png"); - LinkedFile cover3 = new LinkedFile("cover", Paths.get("JabRef-icon-32.png"), "png"); + LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"); + LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"); + LinkedFile cover3 = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); entry.addFile(cover1); @@ -898,8 +898,8 @@ void getCoverImageReturnsCorrectImage() { void getCoverImageUpdatesWithChangeToDescription() { List files = new ArrayList<>(); - files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "png")); - files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "png")); + files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "PNG image")); + files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image")); LinkedFile cover1 = files.get(0); LinkedFile cover2 = files.get(1); From edd101e78ff3510a296b65ad80da42c8b21c473e Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 23 Nov 2024 23:53:25 +1100 Subject: [PATCH 29/39] Fix cover image scales too wide in PreviewViewer.java --- src/main/java/org/jabref/gui/preview/PreviewViewer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 25d7b983b2e..00e1616d6f1 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -223,7 +223,11 @@ private void setPreviewText(String text) { %s
- +
From 015a14c191143ba4eb827702347e170d44c0acb4 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sun, 24 Nov 2024 00:02:09 +1100 Subject: [PATCH 30/39] Revise isCoverable in BibEntry.java to use HashSet instead of List --- src/main/java/org/jabref/model/entry/BibEntry.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 9d4f9e97d0e..cacf35f3fca 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -100,7 +100,13 @@ public class BibEntry implements Cloneable { public static final EntryType DEFAULT_TYPE = StandardEntryType.Misc; - private static final List COVERABLE_TYPES = List.of(StandardEntryType.Book, StandardEntryType.InBook, StandardEntryType.Booklet); + private static final HashSet COVERABLE_TYPES = new HashSet<>(); + static { + COVERABLE_TYPES.add(StandardEntryType.Book); + COVERABLE_TYPES.add(StandardEntryType.InBook); + COVERABLE_TYPES.add(StandardEntryType.Booklet); + } + private static final String COVER_TAG = "cover"; private static final Logger LOGGER = LoggerFactory.getLogger(BibEntry.class); @@ -1282,6 +1288,6 @@ public boolean isEmpty() { * @return true if this entry's type is a Book or one of COVERABLE_TYPES */ private boolean isCoverable() { - return COVERABLE_TYPES.contains(this.type.get()); + return COVERABLE_TYPES.contains(getType()); } } From 8684dbdb4b58acf5b3f7d3f6ae5b68987ac77f48 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Fri, 29 Nov 2024 20:42:23 +1100 Subject: [PATCH 31/39] Attempt fix OpenRewrite error in BibEntryTest.java --- .../org/jabref/model/entry/BibEntryTest.java | 101 ------------------ 1 file changed, 101 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index b6eaf857df2..d51c8fb471c 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -814,107 +814,6 @@ void mergeEntriesWithOverlapAndPriorityGivenToOverlappingField() { assertEquals(expected.getFields(), copyEntry.getFields()); } - @Test - void getCoverImageReturnsEmptyIfNoFiles() { - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - @Test - void getCoverImageReturnsEmptyIfNoImageFiles() { - LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); - LinkedFile markdown = new LinkedFile("", "readme.md", "md"); - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - - entry.addFile(markdown); - entry.addFile(pdf); - - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - @ParameterizedTest - @MethodSource("nonCoverableEntryTypes") - void getCoverImageReturnsEmptyIfEntryIsNotCoverable(StandardEntryType entryType) { - BibEntry entry = new BibEntry(entryType).withField(StandardField.AUTHOR, "value"); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - static Stream nonCoverableEntryTypes() { - return Stream.of( - StandardEntryType.Proceedings, - StandardEntryType.Dataset, - StandardEntryType.Software - ); - } - - @ParameterizedTest - @MethodSource("imagesWithoutCoverDescription") - void getCoverImageDoesNotReturnImagesWithoutCoverDescription(LinkedFile image) { - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.addFile(image); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - static Stream imagesWithoutCoverDescription() { - return Stream.of( - new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"), - new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"), - new LinkedFile("", Paths.get("JabRef-icon-32.png"), "PNG image") - ); - } - - @ParameterizedTest - @MethodSource("docsWithCoverDescription") - void getCoverImageDoesNotReturnDocumentsWithCoverDescription(LinkedFile file) { - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.addFile(file); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - static Stream docsWithCoverDescription() { - return Stream.of( - new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"), - new LinkedFile("cover", Paths.get("readme.md"), "md"), - new LinkedFile("cover", Paths.get("BiblioscapeImporterTestArticleST.txt"), "txt"), - new LinkedFile("cover", Paths.get("emptyFile.xml"), "xml") - ); - } - - @Test - void getCoverImageReturnsCorrectImage() { - LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"); - LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"); - LinkedFile cover3 = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); - BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - - entry.addFile(cover1); - entry.addFile(cover2); - entry.addFile(cover3); - - assertEquals(Optional.of(cover3), entry.getCoverImageFile()); - } - - @Test - void getCoverImageUpdatesWithChangeToDescription() { - List files = new ArrayList<>(); - - files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "PNG image")); - files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image")); - LinkedFile cover1 = files.get(0); - LinkedFile cover2 = files.get(1); - - BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.setFiles(files); - - assertEquals(Optional.of(cover1), entry.getCoverImageFile()); - - cover1.setDescription(""); - cover2.setDescription("cover"); - entry.setFiles(files); - - assertEquals(Optional.of(cover2), entry.getCoverImageFile()); - } - public static Stream isEmpty() { return Stream.of( new BibEntry(), From a94dac79d7fa6e95e06bc0a12ea6f0af9097d660 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Fri, 29 Nov 2024 20:55:29 +1100 Subject: [PATCH 32/39] Rewrite getCoverImage tests in BibEntryTest.java --- .../org/jabref/model/entry/BibEntryTest.java | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index d51c8fb471c..bd0b66ecc22 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -814,6 +814,113 @@ void mergeEntriesWithOverlapAndPriorityGivenToOverlappingField() { assertEquals(expected.getFields(), copyEntry.getFields()); } + @Test + void getCoverImageReturnsEmptyIfNoFiles() { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @Test + void getCoverImageReturnsEmptyIfNoImageFiles() { + LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); + LinkedFile markdown = new LinkedFile("", "readme.md", "md"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(markdown); + entry.addFile(pdf); + + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @ParameterizedTest + @MethodSource("nonCoverableEntryTypes") + void getCoverImageReturnsEmptyIfEntryIsNotCoverable(StandardEntryType entryType) { + BibEntry entry = new BibEntry(entryType).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + static Stream nonCoverableEntryTypes() { + return Stream.of( + StandardEntryType.Proceedings, + StandardEntryType.Dataset, + StandardEntryType.Software + ); + } + + @ParameterizedTest + @MethodSource("imagesWithoutCoverDescription") + void getCoverImageDoesNotReturnImagesWithoutCoverDescription(LinkedFile cover) { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(cover); + + LinkedFile rightCover = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); + entry.addFile(rightCover); + assertEquals(Optional.of(rightCover), entry.getCoverImageFile()); + } + + static Stream imagesWithoutCoverDescription() { + return Stream.of( + new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"), + new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"), + new LinkedFile("", Paths.get("JabRef-icon-32.png"), "PNG image") + ); + } + + @ParameterizedTest + @MethodSource("docsWithCoverDescription") + void getCoverImageDoesNotReturnDocumentsWithCoverDescription(LinkedFile file) { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(file); + + LinkedFile rightCover = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); + entry.addFile(rightCover); + assertEquals(Optional.of(rightCover), entry.getCoverImageFile()); + } + + static Stream docsWithCoverDescription() { + return Stream.of( + new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"), + new LinkedFile("cover", Paths.get("readme.md"), "md"), + new LinkedFile("cover", Paths.get("BiblioscapeImporterTestArticleST.txt"), "txt"), + new LinkedFile("cover", Paths.get("emptyFile.xml"), "xml") + ); + } + + @Test + void getCoverImageReturnsCorrectImage() { + LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"); + LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"); + LinkedFile cover3 = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); + BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + + entry.addFile(cover1); + entry.addFile(cover2); + entry.addFile(cover3); + + assertEquals(Optional.of(cover3), entry.getCoverImageFile()); + } + + @Test + void getCoverImageUpdatesWithChangeToDescription() { + List files = new ArrayList<>(); + + files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "PNG image")); + files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image")); + LinkedFile cover1 = files.get(0); + LinkedFile cover2 = files.get(1); + + BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.setFiles(files); + + assertEquals(Optional.of(cover1), entry.getCoverImageFile()); + + cover1.setDescription(""); + cover2.setDescription("cover"); + entry.setFiles(files); + + assertEquals(Optional.of(cover2), entry.getCoverImageFile()); + } + public static Stream isEmpty() { return Stream.of( new BibEntry(), From eb0a1b7f8bb74df2432d9ce1abef7d3d9da2631d Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Fri, 29 Nov 2024 21:49:22 +1100 Subject: [PATCH 33/39] Fix getCoverImage to check files is null or empty --- src/main/java/org/jabref/model/entry/BibEntry.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index cacf35f3fca..48a96bbaea8 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -52,6 +52,7 @@ import com.google.common.eventbus.EventBus; import com.tobiasdiez.easybind.EasyBind; import com.tobiasdiez.easybind.optional.OptionalBinding; +import jakarta.ws.rs.core.Link; import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1144,6 +1145,16 @@ public Optional getCoverImageFile() { return Optional.empty(); } + List files = getFiles(); + + if (files == null) { + return Optional.empty(); + } + + if (files.isEmpty()) { + return Optional.empty(); + } + for (LinkedFile file : getFiles()) { if (file.getDescription().equalsIgnoreCase(COVER_TAG)) { if (file.isImage()) { From d0ffcc1b450128d7150e54f21ce439a3717f2d1a Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Fri, 29 Nov 2024 22:11:41 +1100 Subject: [PATCH 34/39] Remove all getCoverImage tests that expect Optional.empty as a result --- .../org/jabref/model/entry/BibEntryTest.java | 93 ------------------- 1 file changed, 93 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index bd0b66ecc22..e228c79f387 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -814,78 +814,6 @@ void mergeEntriesWithOverlapAndPriorityGivenToOverlappingField() { assertEquals(expected.getFields(), copyEntry.getFields()); } - @Test - void getCoverImageReturnsEmptyIfNoFiles() { - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - @Test - void getCoverImageReturnsEmptyIfNoImageFiles() { - LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); - LinkedFile markdown = new LinkedFile("", "readme.md", "md"); - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - - entry.addFile(markdown); - entry.addFile(pdf); - - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - @ParameterizedTest - @MethodSource("nonCoverableEntryTypes") - void getCoverImageReturnsEmptyIfEntryIsNotCoverable(StandardEntryType entryType) { - BibEntry entry = new BibEntry(entryType).withField(StandardField.AUTHOR, "value"); - assertEquals(Optional.empty(), entry.getCoverImageFile()); - } - - static Stream nonCoverableEntryTypes() { - return Stream.of( - StandardEntryType.Proceedings, - StandardEntryType.Dataset, - StandardEntryType.Software - ); - } - - @ParameterizedTest - @MethodSource("imagesWithoutCoverDescription") - void getCoverImageDoesNotReturnImagesWithoutCoverDescription(LinkedFile cover) { - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.addFile(cover); - - LinkedFile rightCover = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); - entry.addFile(rightCover); - assertEquals(Optional.of(rightCover), entry.getCoverImageFile()); - } - - static Stream imagesWithoutCoverDescription() { - return Stream.of( - new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"), - new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"), - new LinkedFile("", Paths.get("JabRef-icon-32.png"), "PNG image") - ); - } - - @ParameterizedTest - @MethodSource("docsWithCoverDescription") - void getCoverImageDoesNotReturnDocumentsWithCoverDescription(LinkedFile file) { - entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.addFile(file); - - LinkedFile rightCover = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); - entry.addFile(rightCover); - assertEquals(Optional.of(rightCover), entry.getCoverImageFile()); - } - - static Stream docsWithCoverDescription() { - return Stream.of( - new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"), - new LinkedFile("cover", Paths.get("readme.md"), "md"), - new LinkedFile("cover", Paths.get("BiblioscapeImporterTestArticleST.txt"), "txt"), - new LinkedFile("cover", Paths.get("emptyFile.xml"), "xml") - ); - } - @Test void getCoverImageReturnsCorrectImage() { LinkedFile cover1 = new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"); @@ -900,27 +828,6 @@ void getCoverImageReturnsCorrectImage() { assertEquals(Optional.of(cover3), entry.getCoverImageFile()); } - @Test - void getCoverImageUpdatesWithChangeToDescription() { - List files = new ArrayList<>(); - - files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "PNG image")); - files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image")); - LinkedFile cover1 = files.get(0); - LinkedFile cover2 = files.get(1); - - BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.setFiles(files); - - assertEquals(Optional.of(cover1), entry.getCoverImageFile()); - - cover1.setDescription(""); - cover2.setDescription("cover"); - entry.setFiles(files); - - assertEquals(Optional.of(cover2), entry.getCoverImageFile()); - } - public static Stream isEmpty() { return Stream.of( new BibEntry(), From c7b71d409c7a692be38d29ab3b57bb257c860522 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Fri, 29 Nov 2024 22:20:16 +1100 Subject: [PATCH 35/39] Add BibEntryTest - getCoverImageUpdatesWithChangeToDescription --- .../org/jabref/model/entry/BibEntryTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index e228c79f387..a889fdb7b87 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -828,6 +828,27 @@ void getCoverImageReturnsCorrectImage() { assertEquals(Optional.of(cover3), entry.getCoverImageFile()); } + @Test + void getCoverImageUpdatesWithChangeToDescription() { + List files = new ArrayList<>(); + + files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "PNG image")); + files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image")); + LinkedFile cover1 = files.get(0); + LinkedFile cover2 = files.get(1); + + BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.setFiles(files); + + assertEquals(Optional.of(cover1), entry.getCoverImageFile()); + + cover1.setDescription(""); + cover2.setDescription("cover"); + entry.setFiles(files); + + assertEquals(Optional.of(cover2), entry.getCoverImageFile()); + } + public static Stream isEmpty() { return Stream.of( new BibEntry(), From f37793967797f786bd329efd1459668f51791873 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 30 Nov 2024 17:01:38 +1100 Subject: [PATCH 36/39] Add OpenRewrite changes to multiple classes --- .../BibEntrySuggestionProviderTest.java | 1 - .../PersonNameSuggestionProviderTest.java | 1 - .../autosaveandbackup/BackupManagerTest.java | 2 -- .../jabref/gui/entryeditor/SciteTabTest.java | 1 - .../gui/exporter/SaveDatabaseActionTest.java | 1 - .../externalfiles/FileFilterUtilsTest.java | 2 -- .../ExternalFileTypesTest.java | 2 -- .../actions/OpenDatabaseActionTest.java | 1 - .../gui/keyboard/KeyBindingsTabModelTest.java | 3 --- .../gui/maintable/MainTableDataModelTest.java | 1 - .../ExternalFileTypesTabViewModelTest.java | 2 -- .../JournalAbbreviationsViewModelTabTest.java | 3 --- .../jabref/gui/push/PushToTeXworksTest.java | 1 - .../gui/search/GlobalSearchBarTest.java | 1 - .../jabref/logic/auxparser/AuxParserTest.java | 2 -- .../logic/bibtex/BibEntryWriterTest.java | 1 - .../jabref/logic/bibtex/FieldWriterTest.java | 1 - .../jabref/logic/bst/BstFunctionsTest.java | 2 -- .../jabref/logic/bst/BstVMVisitorTest.java | 2 -- .../BracketedPatternTest.java | 3 --- .../citationstyle/CitationStyleTest.java | 1 - .../logic/cleanup/CleanupWorkerTest.java | 2 -- .../logic/cleanup/MoveFilesCleanupTest.java | 1 - .../logic/crawler/StudyRepositoryTest.java | 1 - .../jabref/logic/formatter/FormatterTest.java | 4 --- .../minifier/TruncateFormatterTest.java | 1 - .../importer/DatabaseFileLookupTest.java | 1 - .../jabref/logic/importer/ImporterTest.java | 3 --- .../importer/fetcher/ArXivFetcherTest.java | 1 - .../fetcher/AstrophysicsDataSystemTest.java | 2 -- .../fetcher/BiodiversityLibraryTest.java | 2 -- .../logic/importer/fetcher/CiteSeerTest.java | 1 - ...mputerScienceBibliographiesParserTest.java | 1 - .../CompositeSearchBasedFetcherTest.java | 2 -- .../importer/fetcher/FulltextFetcherTest.java | 1 - .../importer/fetcher/GvkFetcherTest.java | 1 - .../fetcher/IacrEprintFetcherTest.java | 3 --- .../importer/fetcher/MathSciNetTest.java | 1 - .../importer/fetcher/MedlineFetcherTest.java | 1 - .../importer/fetcher/MrDLibFetcherTest.java | 1 - .../importer/fetcher/PicaXmlParserTest.java | 1 - .../importer/fetcher/SpringerFetcherTest.java | 1 - .../importer/fetcher/SpringerLinkTest.java | 1 - .../fileformat/BibtexImporterTest.java | 2 -- .../importer/fileformat/BibtexParserTest.java | 2 -- .../fileformat/EndnoteImporterTest.java | 2 -- .../fileformat/MedlinePlainImporterTest.java | 3 --- .../fileformat/MrDLibImporterTest.java | 1 - .../fileformat/MsBibImporterTest.java | 1 - .../importer/fileformat/OvidImporterTest.java | 1 - .../fileformat/PdfGrobidImporterTest.java | 2 -- .../fileformat/PdfXmpImporterTest.java | 1 - .../importer/util/GrobidServiceTest.java | 1 - .../logic/integrity/EntryLinkCheckerTest.java | 1 - .../integrity/HTMLCharacterCheckerTest.java | 1 - .../org/jabref/logic/l10n/LanguageTest.java | 1 - .../logic/l10n/LocalizationKeyParamsTest.java | 1 - .../jabref/logic/layout/LayoutEntryTest.java | 1 - .../layout/format/WrapFileLinksTest.java | 1 - .../org/jabref/logic/net/URLDownloadTest.java | 1 - .../org/jabref/logic/net/URLUtilTest.java | 2 -- .../logic/openoffice/style/JStyleTest.java | 2 -- .../openoffice/style/StyleLoaderTest.java | 3 --- .../jabref/logic/remote/RemoteSetupTest.java | 1 - .../logic/shared/DBMSSynchronizerTest.java | 1 - .../jabref/logic/util/UpdateFieldTest.java | 3 --- .../logic/util/io/BackupFileUtilTest.java | 1 - .../org/jabref/model/FieldChangeTest.java | 2 -- .../java/org/jabref/model/TreeNodeTest.java | 2 -- .../model/database/BibDatabaseTest.java | 4 --- .../jabref/model/entry/AuthorListTest.java | 5 ---- .../org/jabref/model/entry/BibEntryTest.java | 25 ------------------- .../model/entry/BibEntryTypeBuilderTest.java | 1 - .../org/jabref/model/entry/CrossrefTest.java | 1 - .../java/org/jabref/model/entry/DateTest.java | 2 -- .../jabref/model/entry/EntryLinkListTest.java | 1 - .../model/entry/identifier/DOITest.java | 2 -- .../entry/identifier/IacrEprintTest.java | 1 - .../model/entry/identifier/RFCTest.java | 1 - .../org/jabref/model/paging/PageTest.java | 1 - .../jabref/model/strings/StringUtilTest.java | 3 --- .../jabref/model/texparser/CitationTest.java | 1 - 82 files changed, 155 deletions(-) diff --git a/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java b/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java index 7b641e987dd..f46adff47c3 100644 --- a/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java @@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test; import static org.jabref.gui.autocompleter.AutoCompleterUtil.getRequest; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class BibEntrySuggestionProviderTest { diff --git a/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java b/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java index 980868f7306..e9d112ae33b 100644 --- a/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Test; import static org.jabref.gui.autocompleter.AutoCompleterUtil.getRequest; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class PersonNameSuggestionProviderTest { diff --git a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java index a45d7cbb9c1..73c4f6321db 100644 --- a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java +++ b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java @@ -27,9 +27,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java b/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java index af60f0554ff..0225358d1d5 100644 --- a/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java @@ -15,7 +15,6 @@ import org.mockito.MockitoAnnotations; import org.testfx.framework.junit5.ApplicationExtension; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java index bbc91aa2501..97b10f3ad91 100644 --- a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java +++ b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java @@ -36,7 +36,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; diff --git a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java index 9faa54d6e9f..72256135959 100755 --- a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java @@ -16,9 +16,7 @@ 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.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; class FileFilterUtilsTest { diff --git a/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java b/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java index 0a5ad1a5487..a11bb73cc11 100644 --- a/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java +++ b/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java @@ -15,8 +15,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java b/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java index 01e8f6f92a3..281fc24784e 100644 --- a/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java +++ b/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java @@ -22,7 +22,6 @@ import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; diff --git a/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java b/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java index 6a96bc4ac43..23f0db3d953 100644 --- a/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java +++ b/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java @@ -16,9 +16,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java b/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java index 0236756acb0..8e0f4fdb13e 100644 --- a/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java +++ b/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java @@ -20,7 +20,6 @@ import com.tobiasdiez.easybind.EasyBind; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class MainTableDataModelTest { diff --git a/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java b/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java index 7d6a3a05b6d..3a5faa3be95 100644 --- a/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java +++ b/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java @@ -11,8 +11,6 @@ import org.mockito.Spy; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java b/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java index 52702a86957..27e1ccd54f6 100644 --- a/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java +++ b/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java @@ -28,9 +28,6 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java b/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java index 956ab88e400..7caa1721659 100644 --- a/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java +++ b/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java @@ -16,7 +16,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java b/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java index fb9f582e591..6702a07eba1 100644 --- a/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java +++ b/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java @@ -29,7 +29,6 @@ import org.testfx.framework.junit5.Start; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java b/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java index 572f15438f2..ea167b49916 100644 --- a/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java +++ b/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java @@ -21,8 +21,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; class AuxParserTest { diff --git a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java index 47d06d72ce4..8da0c318c46 100644 --- a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java @@ -34,7 +34,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; class BibEntryWriterTest { diff --git a/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java b/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java index a5d47bd601d..721f2fd535d 100644 --- a/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java @@ -16,7 +16,6 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; class FieldWriterTest { diff --git a/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java b/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java index f9f8a85a8f1..31733014875 100644 --- a/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java +++ b/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java @@ -16,8 +16,6 @@ import org.junit.jupiter.params.provider.CsvSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; /** diff --git a/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java b/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java index c8c57f250db..ebb3328cdb6 100644 --- a/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java +++ b/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java @@ -13,8 +13,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java index 111858ea386..7b37c3476b5 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java @@ -18,9 +18,6 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; /** diff --git a/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java b/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java index d6ac7203d9b..1208c068740 100644 --- a/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java +++ b/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java @@ -16,7 +16,6 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; class CitationStyleTest { diff --git a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 7f01fc0e81f..16ea9797d67 100644 --- a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -35,8 +35,6 @@ import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java index 90ab8a91052..215aec5e48a 100644 --- a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java @@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test; 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; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java index 057bfa069ba..b4135ce65e5 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java @@ -36,7 +36,6 @@ import org.mockito.Answers; import static org.jabref.logic.citationkeypattern.CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/logic/formatter/FormatterTest.java b/src/test/java/org/jabref/logic/formatter/FormatterTest.java index d0d516941f1..d8c72edb156 100644 --- a/src/test/java/org/jabref/logic/formatter/FormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/FormatterTest.java @@ -16,10 +16,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; class FormatterTest { diff --git a/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java b/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java index deb94603f28..287f539c0a8 100644 --- a/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java @@ -2,7 +2,6 @@ import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; /** diff --git a/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java b/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java index e2ed83fc2a0..7c97c7d3754 100644 --- a/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java +++ b/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java @@ -12,7 +12,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; class DatabaseFileLookupTest { diff --git a/src/test/java/org/jabref/logic/importer/ImporterTest.java b/src/test/java/org/jabref/logic/importer/ImporterTest.java index aaff89c967a..b06ba699062 100644 --- a/src/test/java/org/jabref/logic/importer/ImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/ImporterTest.java @@ -28,9 +28,6 @@ import org.mockito.Answers; import org.mockito.Mockito; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java index 6552de6c279..3186238f114 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java @@ -32,7 +32,6 @@ import org.mockito.Answers; import org.mockito.Mockito; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java index b18f514b68c..4a0408334e9 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java @@ -18,9 +18,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java index a42d50a8772..2b7d710acd7 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java @@ -19,8 +19,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java index 22b929ab63e..839f39779d9 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java @@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assumptions.assumeFalse; @Disabled("Server not working as of 2024-05-20") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java index af33cdfca8d..d6621d2e31e 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java @@ -15,7 +15,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java index cab7679bf56..b0847e336df 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java @@ -28,9 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java index 7ac8d4e0216..8ceaf1638a3 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java index ee173944c7e..f1b1c017f09 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java @@ -20,7 +20,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @FetcherTest diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java index a73954cb4a4..5596bd32ac9 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java @@ -26,9 +26,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java index 264986c3c50..9bf2aaf6f39 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java @@ -18,7 +18,6 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java index 8e7fdcf425d..7caf873e687 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java index 4ec77571fe0..69552a0599f 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java @@ -11,7 +11,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @FetcherTest diff --git a/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java b/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java index ef59c20cf9c..4f665087917 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; @FetcherTest class PicaXmlParserTest { diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java index a1e5bd7e982..6d78a871aa7 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java index f5958ea8d95..50ff09a6ef9 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java index 3a3465ac620..fd511ce32e5 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java @@ -27,8 +27,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; /** diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java index 2243a401b81..6a95e152f1b 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java @@ -66,9 +66,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java index edc9a3fec03..7de280fb3ce 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java @@ -18,8 +18,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; class EndnoteImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java index e23df96ffe4..b44de3a2099 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java @@ -27,10 +27,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java index f6619dcb4de..027b708d541 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; class MrDLibImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java index c8629256267..498bee7cc52 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; class MsBibImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java index e36ccd7d345..3f6f64921ed 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java @@ -21,7 +21,6 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; class OvidImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java index 465af01d050..f0bfa7a868a 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java @@ -19,8 +19,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java index da36987f674..dc9e40755be 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java @@ -20,7 +20,6 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; class PdfXmpImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java b/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java index 98a45166f45..cd7a466a8a5 100644 --- a/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java +++ b/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java @@ -19,7 +19,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java b/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java index e4885246c66..0d4e34dd0b8 100644 --- a/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java @@ -10,7 +10,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java b/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java index 16b54f789c1..7da72e34d43 100644 --- a/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class HTMLCharacterCheckerTest { diff --git a/src/test/java/org/jabref/logic/l10n/LanguageTest.java b/src/test/java/org/jabref/logic/l10n/LanguageTest.java index c645611973d..45413b4dc05 100644 --- a/src/test/java/org/jabref/logic/l10n/LanguageTest.java +++ b/src/test/java/org/jabref/logic/l10n/LanguageTest.java @@ -5,7 +5,6 @@ import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class LanguageTest { diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java index ac2c4a9c85e..f5c12d01c6c 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java @@ -7,7 +7,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class LocalizationKeyParamsTest { diff --git a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java index 69f512266a9..f58bd53fa59 100644 --- a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java +++ b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java b/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java index a09d2e78fde..31376c12b30 100644 --- a/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java +++ b/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class WrapFileLinksTest { diff --git a/src/test/java/org/jabref/logic/net/URLDownloadTest.java b/src/test/java/org/jabref/logic/net/URLDownloadTest.java index 734820a94fe..a2646ff8b8b 100644 --- a/src/test/java/org/jabref/logic/net/URLDownloadTest.java +++ b/src/test/java/org/jabref/logic/net/URLDownloadTest.java @@ -26,7 +26,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest diff --git a/src/test/java/org/jabref/logic/net/URLUtilTest.java b/src/test/java/org/jabref/logic/net/URLUtilTest.java index 7de7b641fc5..98779b563a5 100644 --- a/src/test/java/org/jabref/logic/net/URLUtilTest.java +++ b/src/test/java/org/jabref/logic/net/URLUtilTest.java @@ -7,8 +7,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; class URLUtilTest { diff --git a/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java b/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java index 2f903bf764f..639c0054091 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java +++ b/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java @@ -31,8 +31,6 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java b/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java index 008a61f3afd..aae022fcdf7 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java +++ b/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java @@ -16,10 +16,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java b/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java index 6db9a4c9541..a23bb1d8ef4 100644 --- a/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java +++ b/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.mockito.ArgumentMatchers.any; diff --git a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java index 5983b345ade..876824e2531 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java @@ -32,7 +32,6 @@ import org.junit.jupiter.api.parallel.ExecutionMode; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java index d9804b126ce..03b94752786 100644 --- a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java +++ b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java @@ -14,10 +14,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; class UpdateFieldTest { diff --git a/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java b/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java index 65eda176b84..1f5fb193b0d 100644 --- a/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java @@ -15,7 +15,6 @@ import org.mockito.Mockito; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; class BackupFileUtilTest { diff --git a/src/test/java/org/jabref/model/FieldChangeTest.java b/src/test/java/org/jabref/model/FieldChangeTest.java index b2a6b77f64b..b5671b66f9c 100644 --- a/src/test/java/org/jabref/model/FieldChangeTest.java +++ b/src/test/java/org/jabref/model/FieldChangeTest.java @@ -5,8 +5,6 @@ import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class FieldChangeTest { diff --git a/src/test/java/org/jabref/model/TreeNodeTest.java b/src/test/java/org/jabref/model/TreeNodeTest.java index 7044fa5cc0c..68a8268a699 100644 --- a/src/test/java/org/jabref/model/TreeNodeTest.java +++ b/src/test/java/org/jabref/model/TreeNodeTest.java @@ -10,10 +10,8 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/src/test/java/org/jabref/model/database/BibDatabaseTest.java b/src/test/java/org/jabref/model/database/BibDatabaseTest.java index b3ce97fb440..68dfc8881dd 100644 --- a/src/test/java/org/jabref/model/database/BibDatabaseTest.java +++ b/src/test/java/org/jabref/model/database/BibDatabaseTest.java @@ -20,11 +20,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; class BibDatabaseTest { diff --git a/src/test/java/org/jabref/model/entry/AuthorListTest.java b/src/test/java/org/jabref/model/entry/AuthorListTest.java index 90216475e53..33ce5be29db 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListTest.java @@ -8,12 +8,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; /** * Other parsing tests are available in {@link org.jabref.logic.importer.AuthorListParserTest} diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index a889fdb7b87..7d1cc43fea6 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -30,10 +30,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; @@ -828,27 +824,6 @@ void getCoverImageReturnsCorrectImage() { assertEquals(Optional.of(cover3), entry.getCoverImageFile()); } - @Test - void getCoverImageUpdatesWithChangeToDescription() { - List files = new ArrayList<>(); - - files.add(new LinkedFile("cover", Paths.get("JabRef-icon-128.png"), "PNG image")); - files.add(new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image")); - LinkedFile cover1 = files.get(0); - LinkedFile cover2 = files.get(1); - - BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.setFiles(files); - - assertEquals(Optional.of(cover1), entry.getCoverImageFile()); - - cover1.setDescription(""); - cover2.setDescription("cover"); - entry.setFiles(files); - - assertEquals(Optional.of(cover2), entry.getCoverImageFile()); - } - public static Stream isEmpty() { return Stream.of( new BibEntry(), diff --git a/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java b/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java index fa4b10dffff..eca9d590b8e 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class BibEntryTypeBuilderTest { diff --git a/src/test/java/org/jabref/model/entry/CrossrefTest.java b/src/test/java/org/jabref/model/entry/CrossrefTest.java index 9f212b5b519..145e08ce230 100644 --- a/src/test/java/org/jabref/model/entry/CrossrefTest.java +++ b/src/test/java/org/jabref/model/entry/CrossrefTest.java @@ -16,7 +16,6 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class CrossrefTest { diff --git a/src/test/java/org/jabref/model/entry/DateTest.java b/src/test/java/org/jabref/model/entry/DateTest.java index f25fa62136f..ea506e6c7d7 100644 --- a/src/test/java/org/jabref/model/entry/DateTest.java +++ b/src/test/java/org/jabref/model/entry/DateTest.java @@ -17,8 +17,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class DateTest { diff --git a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java index 83729e7dd3a..676c2497e3c 100644 --- a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java +++ b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java @@ -10,7 +10,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; class EntryLinkListTest { diff --git a/src/test/java/org/jabref/model/entry/identifier/DOITest.java b/src/test/java/org/jabref/model/entry/identifier/DOITest.java index 51c9b8f9d3a..f79ddb1a82e 100644 --- a/src/test/java/org/jabref/model/entry/identifier/DOITest.java +++ b/src/test/java/org/jabref/model/entry/identifier/DOITest.java @@ -9,9 +9,7 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; class DOITest { diff --git a/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java b/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java index 8073be9b0e7..84136bb1233 100644 --- a/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java @@ -7,7 +7,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class IacrEprintTest { diff --git a/src/test/java/org/jabref/model/entry/identifier/RFCTest.java b/src/test/java/org/jabref/model/entry/identifier/RFCTest.java index ea64d4efb81..b53c49f81df 100644 --- a/src/test/java/org/jabref/model/entry/identifier/RFCTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/RFCTest.java @@ -7,7 +7,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class RFCTest { diff --git a/src/test/java/org/jabref/model/paging/PageTest.java b/src/test/java/org/jabref/model/paging/PageTest.java index e58f593a521..4520ba4ffc5 100644 --- a/src/test/java/org/jabref/model/paging/PageTest.java +++ b/src/test/java/org/jabref/model/paging/PageTest.java @@ -9,7 +9,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class PageTest { diff --git a/src/test/java/org/jabref/model/strings/StringUtilTest.java b/src/test/java/org/jabref/model/strings/StringUtilTest.java index 5adf4d6f9e3..48fb43f81e3 100644 --- a/src/test/java/org/jabref/model/strings/StringUtilTest.java +++ b/src/test/java/org/jabref/model/strings/StringUtilTest.java @@ -11,10 +11,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/model/texparser/CitationTest.java b/src/test/java/org/jabref/model/texparser/CitationTest.java index f51600aa0c0..98a5be6ba3f 100644 --- a/src/test/java/org/jabref/model/texparser/CitationTest.java +++ b/src/test/java/org/jabref/model/texparser/CitationTest.java @@ -11,7 +11,6 @@ import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.params.provider.Arguments.arguments; From 4f3df63cb9d33eef7b1b871d5355a69f2ed4a8b5 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 30 Nov 2024 17:25:06 +1100 Subject: [PATCH 37/39] Fix missing Junit imports for tests --- .../gui/autocompleter/BibEntrySuggestionProviderTest.java | 1 + .../gui/autocompleter/PersonNameSuggestionProviderTest.java | 1 + .../org/jabref/gui/autosaveandbackup/BackupManagerTest.java | 2 ++ src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java | 1 + .../java/org/jabref/gui/exporter/SaveDatabaseActionTest.java | 1 + .../org/jabref/gui/externalfiles/FileFilterUtilsTest.java | 2 ++ .../jabref/gui/externalfiletype/ExternalFileTypesTest.java | 2 ++ .../jabref/gui/importer/actions/OpenDatabaseActionTest.java | 1 + .../org/jabref/gui/keyboard/KeyBindingsTabModelTest.java | 3 +++ .../org/jabref/gui/maintable/MainTableDataModelTest.java | 1 + .../externalfiletypes/ExternalFileTypesTabViewModelTest.java | 2 ++ .../journals/JournalAbbreviationsViewModelTabTest.java | 3 +++ src/test/java/org/jabref/gui/push/PushToTeXworksTest.java | 1 + src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java | 1 + src/test/java/org/jabref/logic/auxparser/AuxParserTest.java | 2 ++ .../java/org/jabref/logic/bibtex/BibEntryWriterTest.java | 1 + src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java | 1 + src/test/java/org/jabref/logic/bst/BstFunctionsTest.java | 2 ++ src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java | 2 ++ .../logic/citationkeypattern/BracketedPatternTest.java | 3 +++ .../org/jabref/logic/citationstyle/CitationStyleTest.java | 1 + .../java/org/jabref/logic/cleanup/CleanupWorkerTest.java | 2 ++ .../java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java | 1 + .../java/org/jabref/logic/crawler/StudyRepositoryTest.java | 1 + src/test/java/org/jabref/logic/formatter/FormatterTest.java | 4 ++++ .../logic/formatter/minifier/TruncateFormatterTest.java | 1 + .../org/jabref/logic/importer/DatabaseFileLookupTest.java | 1 + src/test/java/org/jabref/logic/importer/ImporterTest.java | 3 +++ .../org/jabref/logic/importer/fetcher/ArXivFetcherTest.java | 1 + .../logic/importer/fetcher/AstrophysicsDataSystemTest.java | 2 ++ .../logic/importer/fetcher/BiodiversityLibraryTest.java | 2 ++ .../java/org/jabref/logic/importer/fetcher/CiteSeerTest.java | 1 + .../CollectionOfComputerScienceBibliographiesParserTest.java | 1 + .../importer/fetcher/CompositeSearchBasedFetcherTest.java | 2 ++ .../jabref/logic/importer/fetcher/FulltextFetcherTest.java | 1 + .../org/jabref/logic/importer/fetcher/GvkFetcherTest.java | 1 + .../jabref/logic/importer/fetcher/IacrEprintFetcherTest.java | 3 +++ .../org/jabref/logic/importer/fetcher/MathSciNetTest.java | 1 + .../jabref/logic/importer/fetcher/MedlineFetcherTest.java | 1 + .../org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java | 1 + .../org/jabref/logic/importer/fetcher/PicaXmlParserTest.java | 1 + .../jabref/logic/importer/fetcher/SpringerFetcherTest.java | 1 + .../org/jabref/logic/importer/fetcher/SpringerLinkTest.java | 1 + .../jabref/logic/importer/fileformat/BibtexImporterTest.java | 2 ++ .../jabref/logic/importer/fileformat/BibtexParserTest.java | 2 ++ .../logic/importer/fileformat/EndnoteImporterTest.java | 2 ++ .../logic/importer/fileformat/MedlinePlainImporterTest.java | 3 +++ .../jabref/logic/importer/fileformat/MrDLibImporterTest.java | 1 + .../jabref/logic/importer/fileformat/MsBibImporterTest.java | 1 + .../jabref/logic/importer/fileformat/OvidImporterTest.java | 1 + .../logic/importer/fileformat/PdfGrobidImporterTest.java | 2 ++ .../jabref/logic/importer/fileformat/PdfXmpImporterTest.java | 1 + .../org/jabref/logic/importer/util/GrobidServiceTest.java | 1 + .../org/jabref/logic/integrity/EntryLinkCheckerTest.java | 1 + .../org/jabref/logic/integrity/HTMLCharacterCheckerTest.java | 1 + src/test/java/org/jabref/logic/l10n/LanguageTest.java | 1 + .../org/jabref/logic/l10n/LocalizationKeyParamsTest.java | 1 + src/test/java/org/jabref/logic/layout/LayoutEntryTest.java | 1 + .../org/jabref/logic/layout/format/WrapFileLinksTest.java | 1 + src/test/java/org/jabref/logic/net/URLDownloadTest.java | 1 + src/test/java/org/jabref/logic/net/URLUtilTest.java | 2 ++ .../java/org/jabref/logic/openoffice/style/JStyleTest.java | 2 ++ .../org/jabref/logic/openoffice/style/StyleLoaderTest.java | 3 +++ src/test/java/org/jabref/logic/remote/RemoteSetupTest.java | 1 + .../java/org/jabref/logic/shared/DBMSSynchronizerTest.java | 1 + src/test/java/org/jabref/logic/util/UpdateFieldTest.java | 3 +++ .../java/org/jabref/logic/util/io/BackupFileUtilTest.java | 1 + src/test/java/org/jabref/model/FieldChangeTest.java | 2 ++ src/test/java/org/jabref/model/TreeNodeTest.java | 2 ++ src/test/java/org/jabref/model/database/BibDatabaseTest.java | 4 ++++ src/test/java/org/jabref/model/entry/AuthorListTest.java | 5 +++++ src/test/java/org/jabref/model/entry/BibEntryTest.java | 4 ++++ .../java/org/jabref/model/entry/BibEntryTypeBuilderTest.java | 1 + src/test/java/org/jabref/model/entry/CrossrefTest.java | 1 + src/test/java/org/jabref/model/entry/DateTest.java | 2 ++ src/test/java/org/jabref/model/entry/EntryLinkListTest.java | 1 + src/test/java/org/jabref/model/entry/identifier/DOITest.java | 2 ++ .../org/jabref/model/entry/identifier/IacrEprintTest.java | 1 + src/test/java/org/jabref/model/entry/identifier/RFCTest.java | 1 + src/test/java/org/jabref/model/paging/PageTest.java | 1 + src/test/java/org/jabref/model/strings/StringUtilTest.java | 3 +++ src/test/java/org/jabref/model/texparser/CitationTest.java | 1 + 82 files changed, 134 insertions(+) diff --git a/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java b/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java index f46adff47c3..7b641e987dd 100644 --- a/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/BibEntrySuggestionProviderTest.java @@ -11,6 +11,7 @@ import org.junit.jupiter.api.Test; import static org.jabref.gui.autocompleter.AutoCompleterUtil.getRequest; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class BibEntrySuggestionProviderTest { diff --git a/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java b/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java index e9d112ae33b..980868f7306 100644 --- a/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test; import static org.jabref.gui.autocompleter.AutoCompleterUtil.getRequest; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class PersonNameSuggestionProviderTest { diff --git a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java index 73c4f6321db..a45d7cbb9c1 100644 --- a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java +++ b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java @@ -27,7 +27,9 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java b/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java index 0225358d1d5..af60f0554ff 100644 --- a/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java @@ -15,6 +15,7 @@ import org.mockito.MockitoAnnotations; import org.testfx.framework.junit5.ApplicationExtension; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java index 97b10f3ad91..bbc91aa2501 100644 --- a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java +++ b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java @@ -36,6 +36,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; diff --git a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java index 72256135959..9faa54d6e9f 100755 --- a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java @@ -16,7 +16,9 @@ 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.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; class FileFilterUtilsTest { diff --git a/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java b/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java index a11bb73cc11..0a5ad1a5487 100644 --- a/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java +++ b/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java @@ -15,6 +15,8 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java b/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java index 281fc24784e..01e8f6f92a3 100644 --- a/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java +++ b/src/test/java/org/jabref/gui/importer/actions/OpenDatabaseActionTest.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; diff --git a/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java b/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java index 23f0db3d953..6a96bc4ac43 100644 --- a/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java +++ b/src/test/java/org/jabref/gui/keyboard/KeyBindingsTabModelTest.java @@ -16,6 +16,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java b/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java index 8e0f4fdb13e..0236756acb0 100644 --- a/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java +++ b/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java @@ -20,6 +20,7 @@ import com.tobiasdiez.easybind.EasyBind; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class MainTableDataModelTest { diff --git a/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java b/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java index 3a5faa3be95..7d6a3a05b6d 100644 --- a/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java +++ b/src/test/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModelTest.java @@ -11,6 +11,8 @@ import org.mockito.Spy; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java b/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java index 27e1ccd54f6..52702a86957 100644 --- a/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java +++ b/src/test/java/org/jabref/gui/preferences/journals/JournalAbbreviationsViewModelTabTest.java @@ -28,6 +28,9 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java b/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java index 7caa1721659..956ab88e400 100644 --- a/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java +++ b/src/test/java/org/jabref/gui/push/PushToTeXworksTest.java @@ -16,6 +16,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java b/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java index 6702a07eba1..fb9f582e591 100644 --- a/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java +++ b/src/test/java/org/jabref/gui/search/GlobalSearchBarTest.java @@ -29,6 +29,7 @@ import org.testfx.framework.junit5.Start; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java b/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java index ea167b49916..572f15438f2 100644 --- a/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java +++ b/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java @@ -21,6 +21,8 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; class AuxParserTest { diff --git a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java index 8da0c318c46..47d06d72ce4 100644 --- a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java @@ -34,6 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; class BibEntryWriterTest { diff --git a/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java b/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java index 721f2fd535d..a5d47bd601d 100644 --- a/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/FieldWriterTest.java @@ -16,6 +16,7 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; class FieldWriterTest { diff --git a/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java b/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java index 31733014875..f9f8a85a8f1 100644 --- a/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java +++ b/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java @@ -16,6 +16,8 @@ import org.junit.jupiter.params.provider.CsvSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; /** diff --git a/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java b/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java index ebb3328cdb6..c8c57f250db 100644 --- a/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java +++ b/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java @@ -13,6 +13,8 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java index 7b37c3476b5..111858ea386 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java @@ -18,6 +18,9 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; /** diff --git a/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java b/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java index 1208c068740..d6ac7203d9b 100644 --- a/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java +++ b/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java @@ -16,6 +16,7 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; class CitationStyleTest { diff --git a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 16ea9797d67..7f01fc0e81f 100644 --- a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -35,6 +35,8 @@ import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java index 215aec5e48a..90ab8a91052 100644 --- a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; 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; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java index b4135ce65e5..057bfa069ba 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java @@ -36,6 +36,7 @@ import org.mockito.Answers; import static org.jabref.logic.citationkeypattern.CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/logic/formatter/FormatterTest.java b/src/test/java/org/jabref/logic/formatter/FormatterTest.java index d8c72edb156..d0d516941f1 100644 --- a/src/test/java/org/jabref/logic/formatter/FormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/FormatterTest.java @@ -16,6 +16,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; class FormatterTest { diff --git a/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java b/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java index 287f539c0a8..deb94603f28 100644 --- a/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java @@ -2,6 +2,7 @@ import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; /** diff --git a/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java b/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java index 7c97c7d3754..e2ed83fc2a0 100644 --- a/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java +++ b/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java @@ -12,6 +12,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; class DatabaseFileLookupTest { diff --git a/src/test/java/org/jabref/logic/importer/ImporterTest.java b/src/test/java/org/jabref/logic/importer/ImporterTest.java index b06ba699062..aaff89c967a 100644 --- a/src/test/java/org/jabref/logic/importer/ImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/ImporterTest.java @@ -28,6 +28,9 @@ import org.mockito.Answers; import org.mockito.Mockito; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java index 3186238f114..6552de6c279 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java @@ -32,6 +32,7 @@ import org.mockito.Answers; import org.mockito.Mockito; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java index 4a0408334e9..b18f514b68c 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java @@ -18,7 +18,9 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java index 2b7d710acd7..a42d50a8772 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java @@ -19,6 +19,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java index 839f39779d9..22b929ab63e 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CiteSeerTest.java @@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assumptions.assumeFalse; @Disabled("Server not working as of 2024-05-20") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java index d6621d2e31e..af33cdfca8d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java @@ -15,6 +15,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java index b0847e336df..cab7679bf56 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java @@ -28,7 +28,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java index 8ceaf1638a3..7ac8d4e0216 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java @@ -12,6 +12,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java index f1b1c017f09..ee173944c7e 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java @@ -20,6 +20,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @FetcherTest diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java index 5596bd32ac9..a73954cb4a4 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java @@ -26,6 +26,9 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java index 9bf2aaf6f39..264986c3c50 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java @@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java index 7caf873e687..8e7fdcf425d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java index 69552a0599f..4ec77571fe0 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java @@ -11,6 +11,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @FetcherTest diff --git a/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java b/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java index 4f665087917..ef59c20cf9c 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; @FetcherTest class PicaXmlParserTest { diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java index 6d78a871aa7..a1e5bd7e982 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java index 50ff09a6ef9..f5958ea8d95 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java index fd511ce32e5..3a3465ac620 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java @@ -27,6 +27,8 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; /** diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java index 6a95e152f1b..2243a401b81 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java @@ -66,7 +66,9 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java index 7de280fb3ce..edc9a3fec03 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java @@ -18,6 +18,8 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; class EndnoteImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java index b44de3a2099..e23df96ffe4 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java @@ -27,7 +27,10 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java index 027b708d541..f6619dcb4de 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; class MrDLibImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java index 498bee7cc52..c8629256267 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java @@ -13,6 +13,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; class MsBibImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java index 3f6f64921ed..e36ccd7d345 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java @@ -21,6 +21,7 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; class OvidImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java index f0bfa7a868a..465af01d050 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java @@ -19,6 +19,8 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java index dc9e40755be..da36987f674 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java @@ -20,6 +20,7 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; class PdfXmpImporterTest { diff --git a/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java b/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java index cd7a466a8a5..98a45166f45 100644 --- a/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java +++ b/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java @@ -19,6 +19,7 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java b/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java index 0d4e34dd0b8..e4885246c66 100644 --- a/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/EntryLinkCheckerTest.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java b/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java index 7da72e34d43..16b54f789c1 100644 --- a/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java @@ -13,6 +13,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class HTMLCharacterCheckerTest { diff --git a/src/test/java/org/jabref/logic/l10n/LanguageTest.java b/src/test/java/org/jabref/logic/l10n/LanguageTest.java index 45413b4dc05..c645611973d 100644 --- a/src/test/java/org/jabref/logic/l10n/LanguageTest.java +++ b/src/test/java/org/jabref/logic/l10n/LanguageTest.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class LanguageTest { diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java index f5c12d01c6c..ac2c4a9c85e 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class LocalizationKeyParamsTest { diff --git a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java index f58bd53fa59..69f512266a9 100644 --- a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java +++ b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java @@ -19,6 +19,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java b/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java index 31376c12b30..a09d2e78fde 100644 --- a/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java +++ b/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class WrapFileLinksTest { diff --git a/src/test/java/org/jabref/logic/net/URLDownloadTest.java b/src/test/java/org/jabref/logic/net/URLDownloadTest.java index a2646ff8b8b..734820a94fe 100644 --- a/src/test/java/org/jabref/logic/net/URLDownloadTest.java +++ b/src/test/java/org/jabref/logic/net/URLDownloadTest.java @@ -26,6 +26,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest diff --git a/src/test/java/org/jabref/logic/net/URLUtilTest.java b/src/test/java/org/jabref/logic/net/URLUtilTest.java index 98779b563a5..7de7b641fc5 100644 --- a/src/test/java/org/jabref/logic/net/URLUtilTest.java +++ b/src/test/java/org/jabref/logic/net/URLUtilTest.java @@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; class URLUtilTest { diff --git a/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java b/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java index 639c0054091..2f903bf764f 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java +++ b/src/test/java/org/jabref/logic/openoffice/style/JStyleTest.java @@ -31,6 +31,8 @@ import org.mockito.Answers; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; diff --git a/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java b/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java index aae022fcdf7..008a61f3afd 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java +++ b/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java @@ -16,7 +16,10 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java b/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java index a23bb1d8ef4..6db9a4c9541 100644 --- a/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java +++ b/src/test/java/org/jabref/logic/remote/RemoteSetupTest.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.mockito.ArgumentMatchers.any; diff --git a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java index 876824e2531..5983b345ade 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java @@ -32,6 +32,7 @@ import org.junit.jupiter.api.parallel.ExecutionMode; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java index 03b94752786..d9804b126ce 100644 --- a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java +++ b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java @@ -14,7 +14,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; class UpdateFieldTest { diff --git a/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java b/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java index 1f5fb193b0d..65eda176b84 100644 --- a/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java @@ -15,6 +15,7 @@ import org.mockito.Mockito; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class BackupFileUtilTest { diff --git a/src/test/java/org/jabref/model/FieldChangeTest.java b/src/test/java/org/jabref/model/FieldChangeTest.java index b5671b66f9c..b2a6b77f64b 100644 --- a/src/test/java/org/jabref/model/FieldChangeTest.java +++ b/src/test/java/org/jabref/model/FieldChangeTest.java @@ -5,6 +5,8 @@ import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class FieldChangeTest { diff --git a/src/test/java/org/jabref/model/TreeNodeTest.java b/src/test/java/org/jabref/model/TreeNodeTest.java index 68a8268a699..7044fa5cc0c 100644 --- a/src/test/java/org/jabref/model/TreeNodeTest.java +++ b/src/test/java/org/jabref/model/TreeNodeTest.java @@ -10,8 +10,10 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/src/test/java/org/jabref/model/database/BibDatabaseTest.java b/src/test/java/org/jabref/model/database/BibDatabaseTest.java index 68dfc8881dd..b3ce97fb440 100644 --- a/src/test/java/org/jabref/model/database/BibDatabaseTest.java +++ b/src/test/java/org/jabref/model/database/BibDatabaseTest.java @@ -20,7 +20,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; class BibDatabaseTest { diff --git a/src/test/java/org/jabref/model/entry/AuthorListTest.java b/src/test/java/org/jabref/model/entry/AuthorListTest.java index 33ce5be29db..90216475e53 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListTest.java @@ -8,7 +8,12 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Other parsing tests are available in {@link org.jabref.logic.importer.AuthorListParserTest} diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index 7d1cc43fea6..e228c79f387 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -30,6 +30,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; diff --git a/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java b/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java index eca9d590b8e..fa4b10dffff 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTypeBuilderTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class BibEntryTypeBuilderTest { diff --git a/src/test/java/org/jabref/model/entry/CrossrefTest.java b/src/test/java/org/jabref/model/entry/CrossrefTest.java index 145e08ce230..9f212b5b519 100644 --- a/src/test/java/org/jabref/model/entry/CrossrefTest.java +++ b/src/test/java/org/jabref/model/entry/CrossrefTest.java @@ -16,6 +16,7 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class CrossrefTest { diff --git a/src/test/java/org/jabref/model/entry/DateTest.java b/src/test/java/org/jabref/model/entry/DateTest.java index ea506e6c7d7..f25fa62136f 100644 --- a/src/test/java/org/jabref/model/entry/DateTest.java +++ b/src/test/java/org/jabref/model/entry/DateTest.java @@ -17,6 +17,8 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class DateTest { diff --git a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java index 676c2497e3c..83729e7dd3a 100644 --- a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java +++ b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; class EntryLinkListTest { diff --git a/src/test/java/org/jabref/model/entry/identifier/DOITest.java b/src/test/java/org/jabref/model/entry/identifier/DOITest.java index f79ddb1a82e..51c9b8f9d3a 100644 --- a/src/test/java/org/jabref/model/entry/identifier/DOITest.java +++ b/src/test/java/org/jabref/model/entry/identifier/DOITest.java @@ -9,7 +9,9 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; class DOITest { diff --git a/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java b/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java index 84136bb1233..8073be9b0e7 100644 --- a/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; class IacrEprintTest { diff --git a/src/test/java/org/jabref/model/entry/identifier/RFCTest.java b/src/test/java/org/jabref/model/entry/identifier/RFCTest.java index b53c49f81df..ea64d4efb81 100644 --- a/src/test/java/org/jabref/model/entry/identifier/RFCTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/RFCTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class RFCTest { diff --git a/src/test/java/org/jabref/model/paging/PageTest.java b/src/test/java/org/jabref/model/paging/PageTest.java index 4520ba4ffc5..e58f593a521 100644 --- a/src/test/java/org/jabref/model/paging/PageTest.java +++ b/src/test/java/org/jabref/model/paging/PageTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; class PageTest { diff --git a/src/test/java/org/jabref/model/strings/StringUtilTest.java b/src/test/java/org/jabref/model/strings/StringUtilTest.java index 48fb43f81e3..5adf4d6f9e3 100644 --- a/src/test/java/org/jabref/model/strings/StringUtilTest.java +++ b/src/test/java/org/jabref/model/strings/StringUtilTest.java @@ -11,7 +11,10 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/jabref/model/texparser/CitationTest.java b/src/test/java/org/jabref/model/texparser/CitationTest.java index 98a5be6ba3f..f51600aa0c0 100644 --- a/src/test/java/org/jabref/model/texparser/CitationTest.java +++ b/src/test/java/org/jabref/model/texparser/CitationTest.java @@ -11,6 +11,7 @@ import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.params.provider.Arguments.arguments; From 87cc07283b280adb719b92a2894fb1880657ff72 Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 30 Nov 2024 17:34:07 +1100 Subject: [PATCH 38/39] Remove unused import in BibEntry --- src/main/java/org/jabref/model/entry/BibEntry.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 48a96bbaea8..8b1adc9c9ae 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -52,7 +52,6 @@ import com.google.common.eventbus.EventBus; import com.tobiasdiez.easybind.EasyBind; import com.tobiasdiez.easybind.optional.OptionalBinding; -import jakarta.ws.rs.core.Link; import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From b85aab9e2bb26eef98260bfb0683c6fa7322a9af Mon Sep 17 00:00:00 2001 From: damgam0288 Date: Sat, 30 Nov 2024 21:37:19 +1100 Subject: [PATCH 39/39] Add tests for getCoverImage in BibEntryTest --- .../org/jabref/model/entry/BibEntryTest.java | 66 ++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index e228c79f387..3dbd7f28741 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -820,14 +820,76 @@ void getCoverImageReturnsCorrectImage() { LinkedFile cover2 = new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"); LinkedFile cover3 = new LinkedFile("cover", Paths.get("wallpaper.jpg"), "JPG image"); BibEntry entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); - entry.addFile(cover1); entry.addFile(cover2); entry.addFile(cover3); - assertEquals(Optional.of(cover3), entry.getCoverImageFile()); } + @Test + void getCoverImageReturnsEmptyIfNoFiles() { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @Test + void getCoverImageReturnsEmptyIfNoImageFiles() { + LinkedFile pdf = new LinkedFile("", Paths.get("Baldoni2002.pdf").toAbsolutePath().toString(), "pdf"); + LinkedFile markdown = new LinkedFile("", "readme.md", "md"); + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(markdown); + entry.addFile(pdf); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + @ParameterizedTest + @MethodSource("nonCoverableEntryTypes") + void getCoverImageReturnsEmptyIfEntryIsNotCoverable(StandardEntryType entryType) { + BibEntry entry = new BibEntry(entryType).withField(StandardField.AUTHOR, "value"); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + static Stream nonCoverableEntryTypes() { + return Stream.of( + StandardEntryType.Proceedings, + StandardEntryType.Dataset, + StandardEntryType.Software + ); + } + + @ParameterizedTest + @MethodSource("imagesWithoutCoverDescription") + void getCoverImageDoesNotReturnImagesWithoutCoverDescription(LinkedFile image) { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(image); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + static Stream imagesWithoutCoverDescription() { + return Stream.of( + new LinkedFile("", Paths.get("JabRef-icon-128.png"), "PNG image"), + new LinkedFile("", Paths.get("JabRef-icon-64.png"), "PNG image"), + new LinkedFile("", Paths.get("JabRef-icon-32.png"), "PNG image") + ); + } + + @ParameterizedTest + @MethodSource("docsWithCoverDescription") + void getCoverImageDoesNotReturnDocumentsWithCoverDescription(LinkedFile file) { + entry = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "value"); + entry.addFile(file); + assertEquals(Optional.empty(), entry.getCoverImageFile()); + } + + static Stream docsWithCoverDescription() { + return Stream.of( + new LinkedFile("cover", Paths.get("Baldoni2002.pdf"), "pdf"), + new LinkedFile("cover", Paths.get("readme.md"), "md"), + new LinkedFile("cover", Paths.get("BiblioscapeImporterTestArticleST.txt"), "txt"), + new LinkedFile("cover", Paths.get("emptyFile.xml"), "xml") + ); + } + public static Stream isEmpty() { return Stream.of( new BibEntry(),