Skip to content

Parameterize tests (issue #676)#3

Merged
merlinymy merged 243 commits into
mainfrom
contribution-to-issue676
Dec 8, 2025
Merged

Parameterize tests (issue #676)#3
merlinymy merged 243 commits into
mainfrom
contribution-to-issue676

Conversation

@merlinymy

@merlinymy merlinymy commented Oct 6, 2025

Copy link
Copy Markdown
Owner

Fixes JabRef#676. This PR only address part of the issue, and my classmates are doing the rest.

This PR refactors several unit tests in the jablib/src/test/java/org/jabref/logic/layout/format/ package to use JUnit 5 parameterized tests.
The goal is to simplify repetitive test logic, improve readability, and make future additions to formatting rules easier to maintain.

Steps to test

  1. Build JabRef as usual
  2. Confirm that the following tests pass:
  • AuthorAndsCommaReplacerTest
  • AuthorFirstAbbrLastCommasTest
  • AuthorLastFirstAbbrCommasTest
  • AuthorLastFirstOxfordCommasTest
  • RTFCharsTest
  • LayoutEntryTest
  1. Verify that test output and behavior are unchanged.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (refactored existing ones)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@merlinymy merlinymy marked this pull request as draft October 6, 2025 23:57
@merlinymy merlinymy requested a review from espertusnu October 6, 2025 23:57
@espertusnu

Copy link
Copy Markdown
Collaborator

I manually tested my changes in running JabRef (always required)

You didn't, and that's okay.

Closes JabRef#676

Test this link.

See also messages on Teams about the JabRef PR.

@merlinymy merlinymy marked this pull request as ready for review October 14, 2025 22:40

@espertusnu espertusnu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.

"bla,; bla",
"_bla.bla.blub,; _bla.bla.blub"
}, delimiter = ';')
void parseMethodCallsSingleNoArgs(String input, String expected) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "single no args" mean here?

I'm also having trouble understanding under function names. Could you help me understand them?

"bla,; bla",
"_bla.bla.blub,; _bla.bla.blub"
}, delimiter = ';')
void parseMethodCallsSingleNoArgs(String input, String expected) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jabref team has said they like for the expected argument to be first.

@ParameterizedTest
@CsvSource(value = {
"bla,foo; bla; foo"
}, delimiter = ';')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's just a single call, sot here's no benefit to parameterizing.

assertEquals("von Neumann, John, Smith, John & Black Brown, Peter",
a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
@ParameterizedTest
@CsvSource({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

assertEquals("\\u169?", formatter.format("{\\copyright}")); // ©
assertEquals("\\u163?", formatter.format("{\\pounds}")); // £
static Stream<Arguments> specialCharacterCases() {
return Stream.of(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you do a method source instead of a CSV source?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first refactor used csvSource and it passed all tests. Then some of the changes from upstream casued the same code to throw a CsvParseException so had to use another way to circumvent the issue

@merlinymy merlinymy force-pushed the contribution-to-issue676 branch 2 times, most recently from 2276cdf to ac41963 Compare November 9, 2025 04:29
@merlinymy

Copy link
Copy Markdown
Owner Author

I have made the changes to address the comment

@merlinymy merlinymy requested a review from espertusnu November 9, 2025 05:22
renovate-bot and others added 19 commits November 19, 2025 14:20
* Automatic field editor: Add Clear content tab + viewmodel

* Removing comments

* PR comment changes

* Bot suggested changes

* Bot suggested changes

* reformat

* fix fxml

* Added tests, reformats and visual modifications. Fixed number of affected files

* Fixed tab number

* CHANGELOG.md

---------

Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
Co-authored-by: Carl Christian Snethlage <calixtus@users.noreply.github.com>
…f#14048)

* Switch to new macos intel runner and update arm runner as well

Refs https://github.blog/changelog/2025-09-19-github-actions-macos-13-runner-image-is-closing-down/

* macos15

* fix target names

* fix target names
* New translations jabref_en.properties (French)

* New translations jabref_en.properties (Italian)
* Prevent brief flash of the default JavaFX (Modena) theme on startup

* Avoid spamming IndexOutOfBoundsException when the theme is updated at runtime

- IndexOutOfBoundsException keeps being thrown although the theme is applied correctly.
 By catching the exception, we avoid spamming the exception to user.

* Fix button-bar buttons truncating long text with ellipsis

* Update Changelog

* use clear

* Revert "Avoid spamming IndexOutOfBoundsException when the theme is updated at runtime"

This reverts commit 7361b5a.

* Update CHANGELOG.md

---------

Co-authored-by: Houssem Nasri <houssem.nasri@360t.com>
Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
* Add checkerframework to jablib

* Add ADR

* Refine

* Revise endorsement for nullness checking framework

Updated endorsement reference to JUnit 6 with a link.

* Migrate to Errorprone with NullAway

* Refine ADR

* Remove jakarta.inject dependency

* Add architecture test

* No eclipse jgit nullable annotations

* Fix architecture test

---------

Co-authored-by: Carl Christian Snethlage <calixtus@users.noreply.github.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
…abRef#14045)

* Merged scite metrics tab into the Citation Relations Tab (now called "Citations") and removed SciteTab from view in EntryEditor.

* Removed SciteTab.java and SciteTabViewModel.java. Moved fetchTallies method to new class ScienceAiFetcher.java. Moved SciteTallyModel to jabref.model.sciteTallies and renamed to TalliesResponse.

* Added info to CHANGELOG.md.

* CHANGELOG formatting.

* Updated CHANGELOG.md after PR comments. Moved URLs to URLs helper class. Added nicer styling to the Citations tab.

* Updated CHANGELOG.md after PR comments. Moved URLs to URLs helper class. Added nicer styling to the Citations tab.

* Added missing localization keys and removed obsolete localization keys.

* Added localization to citation tab labels

* Renamed labels in Citations tab and added a help button with a popup explaining the source and linking to the respective page.

* Updated Citation Metrics section to a single line

* Made Citation Metrics a single line. Also broke up its text into elements to have better separation.

* Removed labels in the Citations tab. The provided by buttons are now entirely in the Metrics line.

---------

Co-authored-by: Mitkens374 <michal.leso@student.tuke.sk>
…JabRef#14031)

* Changed ComboBox to SearchableComboBox in FieldFormatterCleanupsPanel

* Changed the combobox to a searchable combobox

* Revert "Changed the combobox to a searchable combobox"

This reverts commit 348762b.

* changed combobox to a searchable combobox

* Added bugfix to CHANGELOG.md

* Corrected an issue number in CHANGELOG.md

* Revise CHANGELOG for recent updates and fixes

Updated CHANGELOG with new features, changes, fixes, and removals.

---------

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
* JabRef#14058 - fix alphabetical ordering

* JabRef#14058 - update change log

* JabRef#14058 feedback - reorder
* Fix search query reset issue after entry deletion

- Add EntriesRemovedEvent listener to MainTableDataModel.SearchIndexListener
- Refresh search matches when entries are removed to prevent stale entries
- Ensure filtered list is properly updated after entry deletion
- Maintain search query state during entry manipulation operations

This fixes the issue where search results would show stale entries
after deleting entries from search results, making it appear as if
the search query was reset even though it remained in the search bar.

* Fix import order for EntriesRemovedEvent

- Move EntriesRemovedEvent import to correct alphabetical position
- Fixes checkstyle ImportOrder violation

* Update CHANGELOG with fixed issue description and link

---------

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
* New translations jabref_en.properties (French)

* New translations jabref_en.properties (Spanish)

* New translations jabref_en.properties (German)

* New translations jabref_en.properties (Italian)

* New translations jabref_en.properties (Turkish)

* New translations jabref_en.properties (Chinese Simplified)

* New translations jabref_en.properties (Portuguese, Brazilian)
Co-authored-by: Ruslan <ruslanpopov1512@gmail.com>
Bumps [jablib/src/main/resources/csl-locales](https://github.com/citation-style-language/locales) from `8c149db` to `fbb76f6`.
- [Release notes](https://github.com/citation-style-language/locales/releases)
- [Commits](citation-style-language/locales@8c149db...fbb76f6)

---
updated-dependencies:
- dependency-name: jablib/src/main/resources/csl-locales
  dependency-version: fbb76f6129728a234c4e42ba598c7bbbedd73301
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jablib/src/main/abbrv.jabref.org](https://github.com/JabRef/abbrv.jabref.org) from `fc3ef9e` to `176c06c`.
- [Release notes](https://github.com/JabRef/abbrv.jabref.org/releases)
- [Commits](JabRef/abbrv.jabref.org@fc3ef9e...176c06c)

---
updated-dependencies:
- dependency-name: jablib/src/main/abbrv.jabref.org
  dependency-version: 176c06c4727fa1005117ead24e8d5b9051e4f3ab
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
koppor and others added 21 commits November 19, 2025 14:20
Co-authored-by: gradle-update-robot <gradle-update-robot@regolo.cc>
…4340)

* Revert "Update Gradle Wrapper from 9.3.0-jabref-1 to 9.1.0 (JabRef#14033)"

This reverts commit 1fc12a7.

* Clean up packages in JabKit

* Fix namings

- entry point: JabKitLauncher
- command "jabkit": JabKit

* First GetCitedWorks

* Add some NonNull annotations

* Fix main class name

* Fix option

* Add initial support for unpaywall downloads

- some alphabetical sorting
- refine comments
- some null markers
- some variable name tweaks

* Fix alphabetical ordering

* No default email for Unpaywall

* Other handling of Unpaywall

* Handle empty key

* Fix key customization

* Revert changes of gradlew and gradlew.bat

* Make UnpayWallFetcher a WebFetcher

* Add CHANGELOG.md line

* Add commands

* Revert "Merge branch 'revert-14033-gradlew-update-9.1.0' into add-cites-citing"

This reverts commit ab02d15, reversing
changes made to 403910e.

* Add links to CHANGELOG.md

* Discard changes to .github/workflows/binaries.yml

* Fix import

* Fix imports

* Fix formatting

* Fix typo

* Fix test

* Add getTestUrl()

* Swap methods

* Fix typo

* Fix formatting

* Adapt tests to new behavior

---------

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
…ef#14124)

* Revert "Update Gradle Wrapper from 9.3.0-jabref-1 to 9.1.0 (JabRef#14033)"

This reverts commit 1fc12a7.

* Revert changes of gradlew and gradlew.bat

* Update gradle

* Add java-module-packaging patch

* Fix tabs vs. spaces

* WIP: Include plugin from source

* Remove second includeBuild

* Commit sub project

* Use released version of java-module-packaging

---------

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
* New translations jabref_en.properties (French)

* New translations jabref_en.properties (Italian)
* Add final modifier and private constructor

* Update exception message
…4345)

* Add final modifier and private constructor

* Update exception message
* Add final modifier and private constructor

* Update exception message
…Ref#14342)

* Add final modifier and private constructor

* Update exception message
…ef#14341)

* Add final modifier and private constructor

* Update exception message
* Add final modifier and private constructor

* Update exception message
@espertusnu

Copy link
Copy Markdown
Collaborator

This shows 627 changed files. In the future, never push force in a PR.

If you tell me what files you changed, I'll take a look at those.

@merlinymy

Copy link
Copy Markdown
Owner Author

This shows 627 changed files. In the future, never push force in a PR.

If you tell me what files you changed, I'll take a look at those.

link to the commit

Sorry for the mess...

I followed these steps before trying to push

git checkout main # switch to main branch git pull upstream main # get the latest changes into the local main branch git push origin main # push those to my repository git checkout contributions-to-issue676 git rebase main

However, my push was rejected because the tip of the branch is behind. I followed the hint provided by git "hint: use 'git pull' before pushing again." But then git asked me to reconcile divergent branches and it gave me three options (merge, rebase and ff only). So I run git config pull.rebase true and be able to pull and push. Can you let me know at which step did I do wrong..

@espertusnu

Copy link
Copy Markdown
Collaborator

Thanks for checking. The problem is with the git rebase main. That should not be done after a PR has been created.

@espertusnu

Copy link
Copy Markdown
Collaborator

Are all of the changes in the linked commit? If not, I'll need a list of file names.

@merlinymy

merlinymy commented Nov 19, 2025 via email

Copy link
Copy Markdown
Owner Author

@merlinymy

Copy link
Copy Markdown
Owner Author

Are all of the changes in the linked commit? If not, I'll need a list of file names.

All of the changes are in the linked commit

@merlinymy merlinymy merged commit 959fd16 into main Dec 8, 2025
@merlinymy merlinymy deleted the contribution-to-issue676 branch December 8, 2025 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve test code (one test per method, ParameterizedTests)