From d87d12c17000172b471b9832bf92fd6d396aa6da Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Fri, 3 Nov 2023 21:13:54 +0100 Subject: [PATCH 01/24] Remove updating search on EntryChangedEvent --- src/main/java/org/jabref/gui/LibraryTab.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index fc4880d2562..425d46ba078 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -928,11 +928,6 @@ public void listen(EntriesAddedEvent addedEntryEvent) { DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); } - @Subscribe - public void listen(EntryChangedEvent entryChangedEvent) { - DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); - } - @Subscribe public void listen(EntriesRemovedEvent removedEntriesEvent) { // IMO only used to update the status (found X entries) From 489c3c8765c919198fd94d5e18862c5dfcf3a7bb Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Fri, 3 Nov 2023 21:29:29 +0100 Subject: [PATCH 02/24] Remove unused import --- src/main/java/org/jabref/gui/LibraryTab.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index 425d46ba078..07c5b859a39 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -66,7 +66,6 @@ import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.event.EntriesEventSource; -import org.jabref.model.entry.event.EntryChangedEvent; import org.jabref.model.entry.event.FieldChangedEvent; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; From be85f96096a9082bf118bfc10df6c72ec413eeac Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Fri, 3 Nov 2023 21:29:41 +0100 Subject: [PATCH 03/24] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b45208a55f2..3a9b285d54f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Removed +- We removed search result auto-updates for edits to BibEntries. [#10619](https://github.com/JabRef/jabref/pull/10619) + ## [5.11] – 2023-10-22 ### Added From c6acfe19ccc33f6425053fc00abec9086cbd6bb8 Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Fri, 3 Nov 2023 21:49:38 +0100 Subject: [PATCH 04/24] Remove filtering on query in maintable --- src/main/java/org/jabref/gui/maintable/MainTableDataModel.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java b/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java index bc91167bb88..310a128c422 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java @@ -48,9 +48,8 @@ public MainTableDataModel(BibDatabaseContext context, PreferencesService prefere entriesFiltered = new FilteredList<>(entriesViewModel); entriesFiltered.predicateProperty().bind( EasyBind.combine(stateManager.activeGroupProperty(), - stateManager.activeSearchQueryProperty(), groupsPreferences.groupViewModeProperty(), - (groups, query, groupViewMode) -> entry -> isMatched(groups, query, entry)) + (groups, groupViewMode) -> entry -> isMatched(groups, Optional.empty(), entry)) ); IntegerProperty resultSize = new SimpleIntegerProperty(); From 32afb6b9a2c2fc99c702d6aee371a7a83d65f0e7 Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Fri, 3 Nov 2023 22:01:27 +0100 Subject: [PATCH 05/24] Revert "Remove filtering on query in maintable" This reverts commit c6acfe19ccc33f6425053fc00abec9086cbd6bb8. --- src/main/java/org/jabref/gui/maintable/MainTableDataModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java b/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java index 310a128c422..bc91167bb88 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java @@ -48,8 +48,9 @@ public MainTableDataModel(BibDatabaseContext context, PreferencesService prefere entriesFiltered = new FilteredList<>(entriesViewModel); entriesFiltered.predicateProperty().bind( EasyBind.combine(stateManager.activeGroupProperty(), + stateManager.activeSearchQueryProperty(), groupsPreferences.groupViewModeProperty(), - (groups, groupViewMode) -> entry -> isMatched(groups, Optional.empty(), entry)) + (groups, query, groupViewMode) -> entry -> isMatched(groups, query, entry)) ); IntegerProperty resultSize = new SimpleIntegerProperty(); From ad59c03cd6056262c6c087c45ee44e80c9de4f11 Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Sat, 4 Nov 2023 14:24:11 +0100 Subject: [PATCH 06/24] Refactor method name to reflect usage --- .../org/jabref/gui/search/GlobalSearchBar.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java index 34ac62b9de0..e419c97b827 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java @@ -201,7 +201,7 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager, Preferences this.setSpacing(4.0); this.setAlignment(Pos.CENTER_LEFT); - Timer searchTask = FxTimer.create(Duration.ofMillis(SEARCH_DELAY), this::performSearch); + Timer searchTask = FxTimer.create(Duration.ofMillis(SEARCH_DELAY), this::updateSearchQuery); BindingsHelper.bindBidirectional( stateManager.activeSearchQueryProperty(), searchField.textProperty(), @@ -238,7 +238,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(regularExpressionButton); regularExpressionButton.setOnAction(event -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.REGULAR_EXPRESSION, regularExpressionButton.isSelected()); - performSearch(); + updateSearchQuery(); }); caseSensitiveButton.setSelected(searchPreferences.isCaseSensitive()); @@ -246,7 +246,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(caseSensitiveButton); caseSensitiveButton.setOnAction(event -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.CASE_SENSITIVE, caseSensitiveButton.isSelected()); - performSearch(); + updateSearchQuery(); }); fulltextButton.setSelected(searchPreferences.isFulltext()); @@ -254,7 +254,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(fulltextButton); fulltextButton.setOnAction(event -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.FULLTEXT, fulltextButton.isSelected()); - performSearch(); + updateSearchQuery(); }); keepSearchString.setSelected(searchPreferences.shouldKeepSearchString()); @@ -262,7 +262,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(keepSearchString); keepSearchString.setOnAction(evt -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.KEEP_SEARCH_STRING, keepSearchString.isSelected()); - performSearch(); + updateSearchQuery(); }); openGlobalSearchButton.disableProperty().bindBidirectional(globalSearchActive); @@ -271,7 +271,7 @@ private void initSearchModifierButtons() { openGlobalSearchButton.setOnAction(evt -> { globalSearchActive.setValue(true); globalSearchResultDialog = new GlobalSearchResultDialog(undoManager); - performSearch(); + updateSearchQuery(); dialogService.showCustomDialogAndWait(globalSearchResultDialog); globalSearchActive.setValue(false); }); @@ -298,9 +298,9 @@ public void focus() { searchField.selectAll(); } - public void performSearch() { + public void updateSearchQuery() { LOGGER.debug("Flags: {}", searchPreferences.getSearchFlags()); - LOGGER.debug("Run search {}", searchField.getText()); + LOGGER.debug("Updated search query: {}", searchField.getText()); // An empty search field should cause the search to be cleared. if (searchField.getText().isEmpty()) { From cc14b158a7b608b9e9a5b5729aafd09ba17bcd32 Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Sat, 4 Nov 2023 15:53:21 +0100 Subject: [PATCH 07/24] Remove SearchListener --- src/main/java/org/jabref/gui/LibraryTab.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index 07c5b859a39..137a9548678 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -155,7 +155,6 @@ public LibraryTab(BibDatabaseContext bibDatabaseContext, setupMainPanel(); setupAutoCompletion(); - this.getDatabase().registerListener(new SearchListener()); this.getDatabase().registerListener(new IndexUpdateListener()); this.getDatabase().registerListener(new EntriesRemovedListener()); @@ -276,7 +275,6 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) { setupMainPanel(); setupAutoCompletion(); - this.getDatabase().registerListener(new SearchListener()); this.getDatabase().registerListener(new EntriesRemovedListener()); // ensure that at each addition of a new entry, the entry is added to the groups interface @@ -917,23 +915,6 @@ public void listen(EntriesRemovedEvent entriesRemovedEvent) { } } - /** - * Ensures that the results of the current search are updated when a new entry is inserted into the database Actual methods for performing search must run in javafx thread - */ - private class SearchListener { - - @Subscribe - public void listen(EntriesAddedEvent addedEntryEvent) { - DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); - } - - @Subscribe - public void listen(EntriesRemovedEvent removedEntriesEvent) { - // IMO only used to update the status (found X entries) - DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); - } - } - private class IndexUpdateListener { @Subscribe From 094437161ad4b046e4c6e786dfc0dfec5c98d79f Mon Sep 17 00:00:00 2001 From: Jonatan Asketorp Date: Sun, 5 Nov 2023 22:11:05 +0100 Subject: [PATCH 08/24] Fix CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d10fa505ae..ce147b0a31f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Removed -- We removed search result auto-updates for edits to BibEntries. [#10619](https://github.com/JabRef/jabref/pull/10619) +- We removed duplicate filtering and sorting operations in the MainTable when editing BibEntries. [#10619](https://github.com/JabRef/jabref/pull/10619) ## [5.11] – 2023-10-22 From d0c8b25ab98f7ce64036e06078a5d38596fdd57e Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 10 Nov 2023 21:59:21 +0100 Subject: [PATCH 09/24] add some more spaces --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be8ef44eccf..992f0055839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We removed duplicate filtering and sorting operations in the MainTable when editing BibEntries. [#10619](https://github.com/JabRef/jabref/pull/10619) + + + ## [5.11] – 2023-10-22 ### Added From 106d0a9b5175e77176f8f907f1c7db35612f9e16 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:52:00 +0000 Subject: [PATCH 10/24] Bump com.tngtech.archunit:archunit-junit5-engine from 1.1.0 to 1.2.0 (#10636) Bumps [com.tngtech.archunit:archunit-junit5-engine](https://github.com/TNG/ArchUnit) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/TNG/ArchUnit/releases) - [Commits](https://github.com/TNG/ArchUnit/compare/v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: com.tngtech.archunit:archunit-junit5-engine dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e573693b08f..85a8d47c107 100644 --- a/build.gradle +++ b/build.gradle @@ -242,7 +242,7 @@ dependencies { testImplementation 'org.mockito:mockito-core:5.6.0' testImplementation 'org.xmlunit:xmlunit-core:2.9.1' testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1' - testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.1.0' + testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.2.0' testImplementation 'com.tngtech.archunit:archunit-junit5-api:1.2.0' testImplementation "org.testfx:testfx-core:4.0.16-alpha" testImplementation "org.testfx:testfx-junit5:4.0.16-alpha" From 60d47a95a6a5e41a52307822b4b93b67693d2471 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:52:52 +0000 Subject: [PATCH 11/24] Bump org.mockito:mockito-core from 5.6.0 to 5.7.0 (#10638) Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.6.0 to 5.7.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.6.0...v5.7.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 85a8d47c107..d0c8c8a2f09 100644 --- a/build.gradle +++ b/build.gradle @@ -239,7 +239,7 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' testImplementation 'org.junit.platform:junit-platform-launcher:1.10.0' - testImplementation 'org.mockito:mockito-core:5.6.0' + testImplementation 'org.mockito:mockito-core:5.7.0' testImplementation 'org.xmlunit:xmlunit-core:2.9.1' testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1' testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.2.0' From c66288fd068f28ef030dc0fc97f29b02804aaaad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:52:57 +0000 Subject: [PATCH 12/24] Bump org.junit.platform:junit-platform-launcher from 1.10.0 to 1.10.1 (#10635) Bumps [org.junit.platform:junit-platform-launcher](https://github.com/junit-team/junit5) from 1.10.0 to 1.10.1. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/commits) --- updated-dependencies: - dependency-name: org.junit.platform:junit-platform-launcher dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d0c8c8a2f09..fa3e64542d5 100644 --- a/build.gradle +++ b/build.gradle @@ -237,7 +237,7 @@ dependencies { testImplementation 'io.github.classgraph:classgraph:4.8.163' testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' - testImplementation 'org.junit.platform:junit-platform-launcher:1.10.0' + testImplementation 'org.junit.platform:junit-platform-launcher:1.10.1' testImplementation 'org.mockito:mockito-core:5.7.0' testImplementation 'org.xmlunit:xmlunit-core:2.9.1' From a7fbf85bcce38ff58457f8747dfca94f15eb12e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:53:32 +0000 Subject: [PATCH 13/24] Bump io.github.classgraph:classgraph from 4.8.163 to 4.8.164 (#10634) Bumps [io.github.classgraph:classgraph](https://github.com/classgraph/classgraph) from 4.8.163 to 4.8.164. - [Release notes](https://github.com/classgraph/classgraph/releases) - [Commits](https://github.com/classgraph/classgraph/compare/classgraph-4.8.163...classgraph-4.8.164) --- updated-dependencies: - dependency-name: io.github.classgraph:classgraph dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fa3e64542d5..6a074a286d1 100644 --- a/build.gradle +++ b/build.gradle @@ -235,7 +235,7 @@ dependencies { // Allow objects "magically" to be mapped to JSON using GSON // implementation 'org.glassfish.jersey.media:jersey-media-json-gson:3.1.1' - testImplementation 'io.github.classgraph:classgraph:4.8.163' + testImplementation 'io.github.classgraph:classgraph:4.8.164' testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' testImplementation 'org.junit.platform:junit-platform-launcher:1.10.1' From eb44690d93763d1c1ebb279b27ee36b5e74430df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:55:07 +0000 Subject: [PATCH 14/24] Bump org.fxmisc.richtext:richtextfx from 0.11.1 to 0.11.2 (#10637) Bumps [org.fxmisc.richtext:richtextfx](https://github.com/FXMisc/RichTextFX) from 0.11.1 to 0.11.2. - [Release notes](https://github.com/FXMisc/RichTextFX/releases) - [Changelog](https://github.com/FXMisc/RichTextFX/blob/master/CHANGELOG.md) - [Commits](https://github.com/FXMisc/RichTextFX/compare/v0.11.1...v0.11.2) --- updated-dependencies: - dependency-name: org.fxmisc.richtext:richtextfx dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6a074a286d1..c72f3c74bd0 100644 --- a/build.gradle +++ b/build.gradle @@ -173,7 +173,7 @@ dependencies { implementation 'de.saxsys:mvvmfx:1.8.0' implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT') implementation 'org.fxmisc.flowless:flowless:0.7.2' - implementation 'org.fxmisc.richtext:richtextfx:0.11.1' + implementation 'org.fxmisc.richtext:richtextfx:0.11.2' implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.90.0') { exclude module: 'javax.inject' // Split package, use only jakarta.inject exclude group: 'org.apache.logging.log4j' From c75506f6f404d759d757837ac2b2ae2e57f40a23 Mon Sep 17 00:00:00 2001 From: Jawad Mouza <96312791+JawadTUE@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:11:27 +0100 Subject: [PATCH 15/24] Added parent field to Hayagriva YAML export (#10633) * added parent field to support publisher and series * added testcase for parent field * changelog * Update CHANGELOG.md Co-authored-by: Christoph --------- Co-authored-by: Christoph --- CHANGELOG.md | 1 + .../resource/layout/hayagrivayaml.layout | 17 ++++++++-- .../exporter/HayagrivaYamlExporterTest.java | 31 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 992f0055839..ffaa0b80b05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415) - We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field. [#10572](https://github.com/JabRef/jabref/issues/10572) - We fixed some small inconsistencies in the user interface. [#10507](https://github.com/JabRef/jabref/issues/10507) [#10458](https://github.com/JabRef/jabref/issues/10458) +- We fixed the issue where the Hayagriva YAML exporter would not include a parent field for the publisher/series. [#10596](https://github.com/JabRef/jabref/issues/10596) ### Removed diff --git a/src/main/resources/resource/layout/hayagrivayaml.layout b/src/main/resources/resource/layout/hayagrivayaml.layout index cd19524d406..b60553bec16 100644 --- a/src/main/resources/resource/layout/hayagrivayaml.layout +++ b/src/main/resources/resource/layout/hayagrivayaml.layout @@ -6,11 +6,24 @@ - \format[Authors(LastFirst, MiddleInitial, Sep =\n - , LastSep =\n - )]{\author} \end{author} \begin{date} date: \date\end{date} +\begin{journal} + parent: + type: periodical + title: \journal +\end{journal} + \begin{journal&&volume}volume: \volume\end{journal&&volume} + \begin{journal&&number}issue: \number\end{journal&&number} + \begin{journal&&publisher}publisher: \publisher\end{journal&&publisher} +\begin{series} + parent: + type: book + title: "\series" +\end{series} +\begin{editor&&number} issue: \number\end{editor&&number} +\begin{editor&&publisher} publisher: \publisher\end{editor&&publisher} \begin{editor} editor: \editor\end{editor} -\begin{publisher} publisher: \publisher\end{publisher} \begin{address} location: \address\end{address} \begin{institution} organization: \institution\end{institution} -\begin{volume} volume: \volume\end{volume} \begin{edition} edition: \edition\end{edition} \begin{pages} page-range: \pages\end{pages} \begin{url} url: \url\end{url} diff --git a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java index 7a058ec059d..0b6356906e9 100644 --- a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java @@ -183,4 +183,35 @@ void passesModifiedCharsetNull(@TempDir Path tempFile) throws Exception { "---"); assertEquals(expected, Files.readAllLines(file)); } + + @Test + public final void exportsCorrectParentField(@TempDir Path tempFile) throws Exception { + BibEntry entry = new BibEntry(StandardEntryType.Article) + .withCitationKey("test") + .withField(StandardField.AUTHOR, "Test Author") + .withField(StandardField.TITLE, "Test Title") + .withField(StandardField.JOURNAL, "Test Publisher") + .withField(StandardField.URL, "http://example.com") + .withField(StandardField.DATE, "2020-10-14"); + + Path file = tempFile.resolve("RandomFileName"); + Files.createFile(file); + hayagrivaYamlExporter.export(databaseContext, file, Collections.singletonList(entry)); + + List expected = List.of( + "---", + "test:", + " type: article", + " title: \"Test Title\"", + " author:", + " - Author, Test", + " date: 2020-10-14", + " parent:", + " type: periodical", + " title: Test Publisher", + " url: http://example.com", + "---"); + + assertEquals(expected, Files.readAllLines(file)); + } } From bdee9b6abb4fd974f46a0a9fceffcc5c54d838a8 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Wed, 15 Nov 2023 03:28:49 +0100 Subject: [PATCH 16/24] Update CSL styles (#10642) Co-authored-by: Siedlerchr --- src/main/resources/csl-styles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/csl-styles b/src/main/resources/csl-styles index 010b77c19b0..5bea241e5a2 160000 --- a/src/main/resources/csl-styles +++ b/src/main/resources/csl-styles @@ -1 +1 @@ -Subproject commit 010b77c19b0928db4cc046258d6797a937e0f460 +Subproject commit 5bea241e5a2acacc29b947e21539be9cbe79c8bd From 14664c3e300ebabf5fbe90a90f6023a2e39c53e3 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Wed, 15 Nov 2023 23:05:28 +0100 Subject: [PATCH 17/24] Use clparse (instead of heylogs) (#10641) * Use clparse+diff for checking additions to non-unreleased sections - Use clparse in tests.yml - Use official release of heylogs * Delete .github/heylogs.java --- .github/heylogs.java | 6 ------ .github/workflows/tests.yml | 36 +++++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 19 deletions(-) delete mode 100644 .github/heylogs.java diff --git a/.github/heylogs.java b/.github/heylogs.java deleted file mode 100644 index aeeb31f8f45..00000000000 --- a/.github/heylogs.java +++ /dev/null @@ -1,6 +0,0 @@ -//DEPS com.github.nbbrd.heylogs:heylogs-cli:0.7.1 -public class heylogs { - public static void main(String... args) throws Exception { - nbbrd.heylogs.cli.HeylogsCommand.main(args); - } -} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f1022654ff..4e81d87e865 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -152,7 +152,7 @@ jobs: You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Markdown". comment_tag: markdown - changelog-non-frozen: + changelog: name: CHANGELOG.md runs-on: ubuntu-latest steps: @@ -161,22 +161,16 @@ jobs: with: submodules: 'false' show-progress: 'false' - fetch-depth: 0 - name: Lint CHANGELOG.md run: | # Install jbang curl -Ls https://sh.jbang.dev | bash -s - app setup export PATH=$PATH:$HOME/.jbang/bin - # ensure that refs are available - BRANCH=`git rev-parse HEAD` - git checkout main - # run heylogs verification - jbang --repos jitpack,central -m nbbrd.heylogs.cli.HeylogsCommand com.github.koppor.heylogs:heylogs-cli:jitpack-SNAPSHOT check CHANGELOG.md --gitdiff main...$BRANCH > heylogs.txt || true + jbang com.github.nbbrd.heylogs:heylogs-cli:0.7.2:bin check CHANGELOG.md > heylogs.txt || true # improve output - sed -i 's/consistent-separator/consistent-separator (ignored)/' heylogs.txt sed -i 's/all-h2-contain-a-version/all-h2-contain-a-version (ignored)/' heylogs.txt cat heylogs.txt @@ -184,6 +178,26 @@ jobs: # exit 1 in case of error # We have 1 "valid" issue in CHANGELOG.md grep -q "1 problem" heylogs.txt || exit 1 + changelog-unreleased-only: + name: CHANGELOG.md - only unreleased touched + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + submodules: 'false' + show-progress: 'false' + fetch-depth: 0 + - name: Install clparse + run: | + curl -LO https://github.com/marcaddeo/clparse/releases/download/0.9.1/clparse-0.9.1-x86_64-unknown-linux-musl.tar.gz + tar xzvf clparse-0.9.1-x86_64-unknown-linux-musl.tar.gz + sudo mv clparse /usr/local/bin/clparse + - name: Check CHANGELOG.md diff + run: | + diff \ + <(git show origin/main:CHANGELOG.md | clparse --format=json --separator=– - | jq '.releases[] | select(.version != null)') \ + <(git show HEAD:CHANGELOG.md | clparse --format=json --separator=– - | jq '.releases[] | select(.version != null)') - name: Add comment on pull request if: ${{ failure() }} uses: thollander/actions-comment-pull-request@v2 @@ -191,11 +205,7 @@ jobs: message: > While the PR was in progress, JabRef released a new version. You have to merge `upstream/main` and move your entry in `CHANGELOG.md` to section `## [Unreleased]`. - - - It might also be that another CHANGELOG.md issue arose. - You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "CHANGELOG.md". - comment_tag: changelog + comment_tag: changelog-unreleased-only tests: name: Unit tests runs-on: ubuntu-latest From 85cd85f8ed0237940da9ac183839f90623a4e8c5 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 16 Nov 2023 03:29:48 +0100 Subject: [PATCH 18/24] Update journal abbreviation lists (#10645) Co-authored-by: github-merge-queue --- buildres/abbrv.jabref.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildres/abbrv.jabref.org b/buildres/abbrv.jabref.org index cf71cb48dbd..5a48c1b35b7 160000 --- a/buildres/abbrv.jabref.org +++ b/buildres/abbrv.jabref.org @@ -1 +1 @@ -Subproject commit cf71cb48dbd78b2d85856e689e2834f14b91fdbc +Subproject commit 5a48c1b35b762f7c14a973099dd53bc686413498 From a3ab7d5c36e5b6d212a5de8b8706b81d7ec9362e Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Fri, 17 Nov 2023 16:53:39 +0100 Subject: [PATCH 19/24] Remove comments - don't work on forks --- .github/workflows/tests.yml | 58 ------------------------------------- 1 file changed, 58 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e81d87e865..86ae1543a1a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,20 +49,6 @@ jobs: checkstyle_version: '10.3' - name: Run checkstyle using gradle run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh - - name: Add comment on pull request - if: ${{ failure() }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: > - Your code currently does not meet JabRef's code guidelines. - We use [Checkstyle](https://checkstyle.sourceforge.io/) to identify issues. - The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR. - Please carefully follow [the setup guide for the codestyle](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html). - Afterwards, please run checkstyle locally and fix the issues. - - - More information on code quality in JabRef is available at . - comment_tag: checkstyle openrewrite: name: OpenRewrite runs-on: ubuntu-latest @@ -81,19 +67,6 @@ jobs: - name: Run OpenRewrite run: | ./gradlew rewriteDryRun - - name: Add comment on pull request - if: ${{ failure() }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: > - Your code currently does not meet JabRef's code guidelines. - We use [OpenRewrite](https://docs.openrewrite.org/) to ensure "modern" Java coding practices. - The issues found can be **automatically fixed**. - Please execute the gradle task *`rewriteRun`*, check the results, commit, and push. - - - You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite". - comment_tag: openrewrite modernizer: name: Modernizer runs-on: ubuntu-latest @@ -114,18 +87,6 @@ jobs: # enable failing of this task if modernizer complains sed -i "s/failOnViolations = false/failOnViolations = true/" build.gradle ./gradlew modernizer - - name: Add comment on pull request - if: ${{ failure() }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: > - Your code currently does not meet JabRef's code guidelines. - We use [Gradle Modernizer Plugin](https://github.com/andygoossens/gradle-modernizer-plugin#gradle-modernizer-plugin) to ensure "modern" Java coding practices. - Please fix the detected errors, commit, and push. - - - You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Modernizer". - comment_tag: modernizer markdown: name: Markdown runs-on: ubuntu-latest @@ -141,17 +102,6 @@ jobs: globs: | *.md docs/**/*.md - - name: Add comment on pull request - if: ${{ failure() }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: > - You modified Markdown (*.md) files. - To ensure consistent styling, we have [markdown-lint](https://github.com/DavidAnson/markdownlint) in place. - [Markdown lint's rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#rules) help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here. - - You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Markdown". - comment_tag: markdown changelog: name: CHANGELOG.md runs-on: ubuntu-latest @@ -198,14 +148,6 @@ jobs: diff \ <(git show origin/main:CHANGELOG.md | clparse --format=json --separator=– - | jq '.releases[] | select(.version != null)') \ <(git show HEAD:CHANGELOG.md | clparse --format=json --separator=– - | jq '.releases[] | select(.version != null)') - - name: Add comment on pull request - if: ${{ failure() }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: > - While the PR was in progress, JabRef released a new version. - You have to merge `upstream/main` and move your entry in `CHANGELOG.md` to section `## [Unreleased]`. - comment_tag: changelog-unreleased-only tests: name: Unit tests runs-on: ubuntu-latest From f300b6f6552f2bc37588020b1609f488cfc4400b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:11:01 +0000 Subject: [PATCH 20/24] Bump com.github.Dansoftowner:jSystemThemeDetector from 3.6 to 3.8 Bumps [com.github.Dansoftowner:jSystemThemeDetector](https://github.com/Dansoftowner/jSystemThemeDetector) from 3.6 to 3.8. - [Release notes](https://github.com/Dansoftowner/jSystemThemeDetector/releases) - [Commits](https://github.com/Dansoftowner/jSystemThemeDetector/compare/3.6...3.8) --- updated-dependencies: - dependency-name: com.github.Dansoftowner:jSystemThemeDetector dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c72f3c74bd0..1b3b37242f5 100644 --- a/build.gradle +++ b/build.gradle @@ -180,7 +180,7 @@ dependencies { } implementation 'org.controlsfx:controlsfx:11.2.0' - implementation 'com.github.Dansoftowner:jSystemThemeDetector:3.6' + implementation 'com.github.Dansoftowner:jSystemThemeDetector:3.8' implementation 'org.jsoup:jsoup:1.16.2' implementation 'com.konghq:unirest-java:3.14.5' From b639d8f0999a857af51494d62c61917640c038de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:20:00 +0000 Subject: [PATCH 21/24] Bump com.fasterxml.jackson.dataformat:jackson-dataformat-yaml (#10653) Bumps [com.fasterxml.jackson.dataformat:jackson-dataformat-yaml](https://github.com/FasterXML/jackson-dataformats-text) from 2.15.3 to 2.16.0. - [Commits](https://github.com/FasterXML/jackson-dataformats-text/compare/jackson-dataformats-text-2.15.3...jackson-dataformats-text-2.16.0) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c72f3c74bd0..56bfbeff40f 100644 --- a/build.gradle +++ b/build.gradle @@ -144,7 +144,7 @@ dependencies { implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.7.0.202309050840-r' - implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.3' + implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.0' implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.15.3' implementation 'com.fasterxml:aalto-xml:1.3.2' From d6a8ffad2f7d1edd84b548a27dd64835f700c3fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:23:09 +0000 Subject: [PATCH 22/24] Bump com.puppycrawl.tools:checkstyle from 10.12.4 to 10.12.5 (#10654) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.12.4 to 10.12.5. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.12.4...checkstyle-10.12.5) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 56bfbeff40f..c34b01ac576 100644 --- a/build.gradle +++ b/build.gradle @@ -248,7 +248,7 @@ dependencies { testImplementation "org.testfx:testfx-junit5:4.0.16-alpha" testImplementation "org.hamcrest:hamcrest-library:2.2" - checkstyle 'com.puppycrawl.tools:checkstyle:10.12.4' + checkstyle 'com.puppycrawl.tools:checkstyle:10.12.5' // xjc needs the runtime as well for the ant task, otherwise it fails xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2' xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2' From 77a360a9f1fcb2cdf7387c649452c5b67788f679 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 00:58:28 +0100 Subject: [PATCH 23/24] Bump org.openrewrite.rewrite from 6.4.0 to 6.5.4 (#10650) * Bump org.openrewrite.rewrite from 6.4.0 to 6.5.4 Bumps org.openrewrite.rewrite from 6.4.0 to 6.5.4. --- updated-dependencies: - dependency-name: org.openrewrite.rewrite dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.4.1 to 2.5.0 Bumps [org.openrewrite.recipe:rewrite-recipe-bom](https://github.com/openrewrite/rewrite-recipe-bom) from 2.4.1 to 2.5.0. - [Release notes](https://github.com/openrewrite/rewrite-recipe-bom/releases) - [Commits](https://github.com/openrewrite/rewrite-recipe-bom/compare/v2.4.1...v2.5.0) --- updated-dependencies: - dependency-name: org.openrewrite.recipe:rewrite-recipe-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Apply one fix only * Disable cast rule --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oliver Kopp --- build.gradle | 4 ++-- buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy | 5 +++-- rewrite.yml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7f09e8154f6..800fa9fe067 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ plugins { id 'idea' - id 'org.openrewrite.rewrite' version '6.4.0' + id 'org.openrewrite.rewrite' version '6.5.4' } // Enable following for debugging @@ -253,7 +253,7 @@ dependencies { xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2' xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2' - rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.4.1")) + rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.5.0")) rewrite("org.openrewrite.recipe:rewrite-static-analysis") rewrite("org.openrewrite.recipe:rewrite-logging-frameworks") rewrite("org.openrewrite.recipe:rewrite-testing-frameworks") diff --git a/buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy b/buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy index 8b68e35ab98..fb7bbf7cdb6 100644 --- a/buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy +++ b/buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy @@ -103,8 +103,9 @@ class XjcTask extends DefaultTask { } private void updateOutput() { - if (outputDirectory != null && javaPackage != null) - outputs.dir(new File(getOutputDirectory(), packageAsPath(javaPackage))) + if (outputDirectory != null && javaPackage != null) { + outputs.dir(new File(getOutputDirectory(), packageAsPath(javaPackage))) + } } private static String packageAsPath(String pkg) { diff --git a/rewrite.yml b/rewrite.yml index 7d5eaad4866..1b146b619a3 100644 --- a/rewrite.yml +++ b/rewrite.yml @@ -163,7 +163,7 @@ recipeList: - org.openrewrite.staticanalysis.RemoveExtraSemicolons - org.openrewrite.staticanalysis.RemoveJavaDocAuthorTag - org.openrewrite.staticanalysis.RemoveHashCodeCallsFromArrayInstances - - org.openrewrite.staticanalysis.RemoveRedundantTypeCast +# - org.openrewrite.staticanalysis.RemoveRedundantTypeCast - org.openrewrite.staticanalysis.RemoveToStringCallsFromArrayInstances - org.openrewrite.staticanalysis.RemoveUnneededAssertion - org.openrewrite.staticanalysis.RemoveUnneededBlock From 75107ab69b1d02c2386019432d03333fcae81a0d Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 21 Nov 2023 09:27:50 +0100 Subject: [PATCH 24/24] Clean up test code (#10658) * Enable org.openrewrite.java.testing.junit5.CleanupAssertions * Fix indent * Update rewrite.yml --- rewrite.yml | 3 +++ .../gui/externalfiles/FileFilterUtilsTest.java | 18 ++++++++++-------- .../maintable/MainTableColumnModelTest.java | 2 +- .../gui/sidepane/SidePaneViewModelTest.java | 12 ++++++------ .../org/jabref/gui/theme/ThemeManagerTest.java | 4 ++-- .../bibtex/comparator/BibStringDiffTest.java | 8 +++----- .../logic/database/DatabaseMergerTest.java | 4 ++-- .../fetcher/IacrEprintFetcherTest.java | 2 +- .../logic/journals/AbbreviationTest.java | 8 ++++---- .../logic/layout/format/ReplaceTest.java | 3 ++- .../jabref/logic/msbib/MsBibAuthorTest.java | 5 +++-- .../java/org/jabref/logic/net/ProxyTest.java | 5 +++-- .../java/org/jabref/model/FieldChangeTest.java | 2 +- .../org/jabref/model/entry/BibEntryTest.java | 6 +++--- .../model/openoffice/CitationEntryTest.java | 2 +- .../jabref/model/strings/StringUtilTest.java | 3 ++- 16 files changed, 47 insertions(+), 40 deletions(-) diff --git a/rewrite.yml b/rewrite.yml index 1b146b619a3..bcb32628d3c 100644 --- a/rewrite.yml +++ b/rewrite.yml @@ -195,3 +195,6 @@ recipeList: - org.openrewrite.staticanalysis.UseSystemLineSeparator - org.openrewrite.staticanalysis.WhileInsteadOfFor # - org.openrewrite.staticanalysis.WriteOctalValuesAsDecimal + + - org.openrewrite.java.testing.junit5.CleanupAssertions +# - org.openrewrite.java.testing.junit5.JUnit5BestPractices diff --git a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java index 9af4b1364bb..9deab592e8f 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; public class FileFilterUtilsTest { @@ -25,42 +27,42 @@ public class FileFilterUtilsTest { @Test public void isDuringLastDayNegativeTest() { - assertEquals(fileFilterUtils.isDuringLastDay(time.minusHours(24)), false); + assertFalse(fileFilterUtils.isDuringLastDay(time.minusHours(24))); } @Test public void isDuringLastDayPositiveTest() { - assertEquals(fileFilterUtils.isDuringLastDay(time.minusHours(23)), true); + assertTrue(fileFilterUtils.isDuringLastDay(time.minusHours(23))); } @Test public void isDuringLastWeekNegativeTest() { - assertEquals(fileFilterUtils.isDuringLastWeek(time.minusDays(7)), false); + assertFalse(fileFilterUtils.isDuringLastWeek(time.minusDays(7))); } @Test public void isDuringLastWeekPositiveTest() { - assertEquals(fileFilterUtils.isDuringLastWeek(time.minusDays(6).minusHours(23)), true); + assertTrue(fileFilterUtils.isDuringLastWeek(time.minusDays(6).minusHours(23))); } @Test public void isDuringLastMonthNegativeTest() { - assertEquals(fileFilterUtils.isDuringLastMonth(time.minusDays(30)), false); + assertFalse(fileFilterUtils.isDuringLastMonth(time.minusDays(30))); } @Test public void isDuringLastMonthPositiveTest() { - assertEquals(fileFilterUtils.isDuringLastMonth(time.minusDays(29).minusHours(23)), true); + assertTrue(fileFilterUtils.isDuringLastMonth(time.minusDays(29).minusHours(23))); } @Test public void isDuringLastYearNegativeTest() { - assertEquals(fileFilterUtils.isDuringLastYear(time.minusDays(365)), false); + assertFalse(fileFilterUtils.isDuringLastYear(time.minusDays(365))); } @Test public void isDuringLastYearPositiveTest() { - assertEquals(fileFilterUtils.isDuringLastYear(time.minusDays(364).minusHours(23)), true); + assertTrue(fileFilterUtils.isDuringLastYear(time.minusDays(364).minusHours(23))); } @Nested diff --git a/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java b/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java index a344886401a..750d92708fb 100644 --- a/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java +++ b/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java @@ -52,6 +52,6 @@ public void typeOnlyMainTableColumnModelParserRetrievesCorrectType() { public void typeOnlyMainTableColumnModelParserRetrievesCorrectQualifier() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testTypeOnlyName); - assertEquals(testColumnModel.getQualifier(), ""); + assertEquals("", testColumnModel.getQualifier()); } } diff --git a/src/test/java/org/jabref/gui/sidepane/SidePaneViewModelTest.java b/src/test/java/org/jabref/gui/sidepane/SidePaneViewModelTest.java index 27db78fe64d..0419752b78e 100644 --- a/src/test/java/org/jabref/gui/sidepane/SidePaneViewModelTest.java +++ b/src/test/java/org/jabref/gui/sidepane/SidePaneViewModelTest.java @@ -76,30 +76,30 @@ void setUp() { void moveUp() { sidePaneViewModel.moveUp(SidePaneType.WEB_SEARCH); - assertEquals(sidePaneComponents.get(0), SidePaneType.WEB_SEARCH); - assertEquals(sidePaneComponents.get(1), SidePaneType.GROUPS); + assertEquals(SidePaneType.WEB_SEARCH, sidePaneComponents.get(0)); + assertEquals(SidePaneType.GROUPS, sidePaneComponents.get(1)); } @Test void moveUpFromFirstPosition() { sidePaneViewModel.moveUp(SidePaneType.GROUPS); - assertEquals(sidePaneComponents.get(0), SidePaneType.GROUPS); + assertEquals(SidePaneType.GROUPS, sidePaneComponents.get(0)); } @Test void moveDown() { sidePaneViewModel.moveDown(SidePaneType.WEB_SEARCH); - assertEquals(sidePaneComponents.get(1), SidePaneType.OPEN_OFFICE); - assertEquals(sidePaneComponents.get(2), SidePaneType.WEB_SEARCH); + assertEquals(SidePaneType.OPEN_OFFICE, sidePaneComponents.get(1)); + assertEquals(SidePaneType.WEB_SEARCH, sidePaneComponents.get(2)); } @Test void moveDownFromLastPosition() { sidePaneViewModel.moveDown(SidePaneType.OPEN_OFFICE); - assertEquals(sidePaneComponents.get(2), SidePaneType.OPEN_OFFICE); + assertEquals(SidePaneType.OPEN_OFFICE, sidePaneComponents.get(2)); } @Test diff --git a/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java b/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java index f96308c18b8..87e1d1a654c 100644 --- a/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java +++ b/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java @@ -145,7 +145,7 @@ public void largeCustomThemeNotHeldInMemory() throws IOException { Files.move(largeCssTestFile, largeCssTestFile.resolveSibling("renamed.css")); // getAdditionalStylesheet() should no longer offer the deleted stylesheet as it is not been held in memory - assertEquals(themeManager.getActiveTheme().getAdditionalStylesheet().get().getWebEngineStylesheet(), "", + assertEquals("", themeManager.getActiveTheme().getAdditionalStylesheet().get().getWebEngineStylesheet(), "didn't expect additional stylesheet after css was deleted"); Files.move(largeCssTestFile.resolveSibling("renamed.css"), largeCssTestFile); @@ -194,7 +194,7 @@ public void installThemeOnWebEngine() throws IOException { }); Assertions.assertDoesNotThrow(() -> { - assertEquals(webEngineStyleSheetLocation.get(), TEST_CSS_DATA); + assertEquals(TEST_CSS_DATA, webEngineStyleSheetLocation.get()); }); } diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java index 28f8ed4d801..03527cb4387 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java @@ -10,9 +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.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -54,17 +52,17 @@ void notEqualTest() { @Test void identicalObjectsAreEqual() { BibStringDiff other = diff; - assertTrue(other.equals(diff)); + assertEquals(other, diff); } @Test void compareToNullObjectIsFalse() { - assertFalse(diff.equals(null)); + assertNotEquals(null, diff); } @Test void compareToDifferentClassIsFalse() { - assertFalse(diff.equals(new Object())); + assertNotEquals(diff, new Object()); } @Test diff --git a/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java b/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java index a7464dbaed5..b6a874c93b6 100644 --- a/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java +++ b/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java @@ -162,7 +162,7 @@ void mergeMetaDataWithoutAllEntriesGroup() { // Assert that groups of other are children of root node of target assertEquals(targetRootGroup, target.getGroups().get()); - assertEquals(target.getGroups().get().getChildren().size(), 1); + assertEquals(1, target.getGroups().get().getChildren().size()); assertEquals(otherRootGroup, target.getGroups().get().getChildren().get(0)); } @@ -185,7 +185,7 @@ void mergeMetaDataWithAllEntriesGroup() { // Assert that groups of other are children of root node of target assertEquals(targetRootGroup, target.getGroups().get()); - assertEquals(target.getGroups().get().getChildren().size(), 1); + assertEquals(1, target.getGroups().get().getChildren().size()); assertEquals(expectedImportedGroupNode, target.getGroups().get().getChildren().get(0)); assertEquals(expectedContentSelectors, target.getContentSelectorList()); } 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 2eb837d2364..c168c4bceb7 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java @@ -168,7 +168,7 @@ public void searchByIdWithOldHtmlFormatWithoutDateCheck(String id) throws Fetche Optional fetchedEntry = fetcher.performSearchById(id); assertTrue(fetchedEntry.isPresent(), "Expected to get an entry for id " + id); assertNotEquals(Optional.empty(), fetchedEntry.get().getField(StandardField.DATE), "Expected non empty date field, entry is\n" + fetchedEntry.toString()); - assertTrue(fetchedEntry.get().getField(StandardField.DATE).get().length() == 10, "Expected yyyy-MM-dd date format, entry is\n" + fetchedEntry.toString()); + assertEquals(10, fetchedEntry.get().getField(StandardField.DATE).get().length(), "Expected yyyy-MM-dd date format, entry is\n" + fetchedEntry.toString()); assertNotEquals(Optional.empty(), fetchedEntry.get().getField(StandardField.ABSTRACT), "Expected non empty abstract field, entry is\n" + fetchedEntry.toString()); } diff --git a/src/test/java/org/jabref/logic/journals/AbbreviationTest.java b/src/test/java/org/jabref/logic/journals/AbbreviationTest.java index 1f3ba7a8eab..423e235c0c2 100644 --- a/src/test/java/org/jabref/logic/journals/AbbreviationTest.java +++ b/src/test/java/org/jabref/logic/journals/AbbreviationTest.java @@ -105,10 +105,10 @@ void testDefaultAndShortestUniqueAbbreviationsAreSame() { @Test void testEquals() { - Abbreviation abbreviation = new Abbreviation("Long Name", "L N", "LN"); - Abbreviation otherAbbreviation = new Abbreviation("Long Name", "L N", "LN"); - assertEquals(abbreviation, otherAbbreviation); - assertNotEquals(abbreviation, "String"); + Abbreviation abbreviation = new Abbreviation("Long Name", "L N", "LN"); + Abbreviation otherAbbreviation = new Abbreviation("Long Name", "L N", "LN"); + assertEquals(abbreviation, otherAbbreviation); + assertNotEquals("String", abbreviation); } @Test diff --git a/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java b/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java index 3d1eb4ebb9b..31bc81144f5 100644 --- a/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ReplaceTest.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.assertNull; public class ReplaceTest { @@ -26,7 +27,7 @@ public void testSimpleTextNoHit() { public void testFormatNull() { ParamLayoutFormatter a = new Replace(); a.setArgument("Eds.,Ed."); - assertEquals(null, a.format(null)); + assertNull(a.format(null)); } @Test diff --git a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java index 3b09b26c7d9..2ccef4f8722 100644 --- a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java +++ b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.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.assertNull; public class MsBibAuthorTest { @@ -26,14 +27,14 @@ public void testGetMiddleName() { public void testGetNoMiddleName() { Author author = new Author("Gustav", null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); - assertEquals(null, msBibAuthor.getMiddleName()); + assertNull(msBibAuthor.getMiddleName()); } @Test public void testGetNoFirstName() { Author author = new Author(null, null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); - assertEquals(null, msBibAuthor.getMiddleName()); + assertNull(msBibAuthor.getMiddleName()); } @Test diff --git a/src/test/java/org/jabref/logic/net/ProxyTest.java b/src/test/java/org/jabref/logic/net/ProxyTest.java index 6b6e844d1b6..20f904441cb 100644 --- a/src/test/java/org/jabref/logic/net/ProxyTest.java +++ b/src/test/java/org/jabref/logic/net/ProxyTest.java @@ -3,6 +3,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ProxyTest { /** @@ -31,10 +32,10 @@ public void testProxyPreferencesStorePassword() { persist); // Check if mock data is stored in object memory and can be extracted - assertEquals(proxyPref.shouldUseProxy(), true); + assertTrue(proxyPref.shouldUseProxy()); assertEquals(proxyPref.getHostname(), hostname); assertEquals(proxyPref.getPort(), port); - assertEquals(proxyPref.shouldUseAuthentication(), true); + assertTrue(proxyPref.shouldUseAuthentication()); assertEquals(proxyPref.getUsername(), username); assertEquals(proxyPref.getPassword(), password); assertEquals(proxyPref.shouldPersistPassword(), persist); diff --git a/src/test/java/org/jabref/model/FieldChangeTest.java b/src/test/java/org/jabref/model/FieldChangeTest.java index 1625a1ae652..b2a6b77f64b 100644 --- a/src/test/java/org/jabref/model/FieldChangeTest.java +++ b/src/test/java/org/jabref/model/FieldChangeTest.java @@ -57,7 +57,7 @@ void selfEqualsFieldchangeDifferentEntry() { @Test void fieldChangeDoesNotEqualString() { - assertNotEquals(fc, "foo"); + assertNotEquals("foo", fc); } @Test diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index b913030cc73..63cd6657bc9 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -364,17 +364,17 @@ void isEmptyCiteKey() { @Test void identicObjectsareEqual() throws Exception { BibEntry otherEntry = entry; - assertTrue(entry.equals(otherEntry)); + assertEquals(entry, otherEntry); } @Test void compareToNullObjectIsFalse() throws Exception { - assertFalse(entry.equals(null)); + assertNotEquals(null, entry); } @Test void compareToDifferentClassIsFalse() throws Exception { - assertFalse(entry.equals(new Object())); + assertNotEquals(entry, new Object()); } @Test diff --git a/src/test/java/org/jabref/model/openoffice/CitationEntryTest.java b/src/test/java/org/jabref/model/openoffice/CitationEntryTest.java index 8648d9b5df9..481afa00eac 100644 --- a/src/test/java/org/jabref/model/openoffice/CitationEntryTest.java +++ b/src/test/java/org/jabref/model/openoffice/CitationEntryTest.java @@ -48,7 +48,7 @@ void testCitationEntryEquals() { assertEquals(citationEntry1, citationEntry1); assertEquals(citationEntry1, citationEntry3); assertNotEquals(citationEntry1, citationEntry2); - assertNotEquals(citationEntry1, "Random String"); + assertNotEquals("Random String", citationEntry1); } @Test diff --git a/src/test/java/org/jabref/model/strings/StringUtilTest.java b/src/test/java/org/jabref/model/strings/StringUtilTest.java index a1ba47b247a..f41584e1939 100644 --- a/src/test/java/org/jabref/model/strings/StringUtilTest.java +++ b/src/test/java/org/jabref/model/strings/StringUtilTest.java @@ -14,6 +14,7 @@ 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; @@ -142,7 +143,7 @@ void testStripBrackets() { assertEquals("]", StringUtil.stripBrackets("]")); assertEquals("", StringUtil.stripBrackets("[]")); assertEquals("f[]f", StringUtil.stripBrackets("f[]f")); - assertEquals(null, StringUtil.stripBrackets(null)); + assertNull(StringUtil.stripBrackets(null)); } @Test