Skip to content

Refactor tests to use parameterized tests 676#14138

Merged
koppor merged 2 commits into
JabRef:mainfrom
zyan-repository:issue-676
Oct 31, 2025
Merged

Refactor tests to use parameterized tests 676#14138
koppor merged 2 commits into
JabRef:mainfrom
zyan-repository:issue-676

Conversation

@zyan-repository

Copy link
Copy Markdown
Contributor

Refs JabRef#676

This pull request parameterizes the existing JUnit 5 tests for the LayoutTest class, URLUtilTest class, OOPreFormatterTest class, RemoteUtilTest class, DefaultTexParserTest class, ISBNTest class and ISSNTest class. This change allows multiple inputs and expected outputs to be tested with the same test logic, which improves code readability and makes it easier to add more test cases in the future. Other PRs from classmates addressing this same issue will follow shortly to complete the task(@espertusnu ).

Steps to test

Execute the Filtered Test Command

./gradlew :jablib:test \
  --tests org.jabref.logic.layout.LayoutTest \
  --tests org.jabref.logic.net.URLUtilTest \
  --tests org.jabref.logic.openoffice.style.OOPreFormatterTest \
  --tests org.jabref.logic.remote.RemoteUtilTest \
  --tests org.jabref.logic.texparser.DefaultTexParserTest \
  --tests org.jabref.model.entry.identifier.ISBNTest \
  --tests org.jabref.model.entry.identifier.ISSNTest

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 (if applicable)
  • [/] 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.

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good first step, but we really should increase readability.

Please learn at https://mikemybytes.com/2021/10/19/parameterize-like-a-pro-with-junit-5-csvsource/ how to write nicely formatted JUnit CsvSource.

Comment thread jablib/src/test/java/org/jabref/logic/net/URLUtilTest.java Outdated
Comment thread jablib/src/test/java/org/jabref/logic/remote/RemoteUtilTest.java Outdated
Comment thread jablib/src/test/java/org/jabref/logic/remote/RemoteUtilTest.java Outdated
Comment thread jablib/src/test/java/org/jabref/logic/texparser/DefaultTexParserTest.java Outdated
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Oct 23, 2025
Split Method	package cleanGoogleSearchURL() : void to [package cleanGoogleSearchURLShouldReturnOriginalURL(input String) : void, package cleanGoogleSearchURLShouldReturnTargetURL(input String, expected String) : void] in class org.jabref.logic.net.URLUtilTest
JabRef/jabref#14138
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Oct 23, 2025
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Oct 23, 2025
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
This changes generates LeafExpression mappings for the tests with a single statement
removeBraces()
equations()
formatStripLatexCommands()
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Oct 23, 2025
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
This change generates LeafExpression mappings for the tests with a single statement
removeBraces()
equations()
formatStripLatexCommands()
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Oct 23, 2025
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
@koppor

koppor commented Oct 24, 2025

Copy link
Copy Markdown
Member

@zyan-repository How long to you plan to work on an improvement? 😅

@zyan-repository

Copy link
Copy Markdown
Contributor Author

@zyan-repository How long to you plan to work on an improvement? 😅

Sorry for the late reply. I had my midterms the last couple of days. I'll have the above content revised by Sunday.

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure about the reformatting, but I want to keep things going.

Reason for not reformatting code without reason: When trying to find issues and trying out to find out where was a semantic change, purely syntactic changes are disturbing.

@koppor koppor merged commit dc4ae6d into JabRef:main Oct 31, 2025
45 checks passed
merlinymy pushed a commit to merlinymy/jabref that referenced this pull request Nov 19, 2025
Co-authored-by: “zyan-repository” <“yianzhou003@gmail.com”>
victorgveloso pushed a commit to victorgveloso/RefactoringMiner that referenced this pull request Nov 25, 2025
Split Method	package cleanGoogleSearchURL() : void to [package cleanGoogleSearchURLShouldReturnOriginalURL(input String) : void, package cleanGoogleSearchURLShouldReturnTargetURL(input String, expected String) : void] in class org.jabref.logic.net.URLUtilTest
JabRef/jabref#14138
victorgveloso pushed a commit to victorgveloso/RefactoringMiner that referenced this pull request Nov 25, 2025
…ntalis#1003)

jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
This change generates LeafExpression mappings for the tests with a single statement
removeBraces()
equations()
formatStripLatexCommands()
victorgveloso pushed a commit to victorgveloso/RefactoringMiner that referenced this pull request Nov 25, 2025
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
Split Method	package cleanGoogleSearchURL() : void to [package cleanGoogleSearchURLShouldReturnOriginalURL(input String) : void, package cleanGoogleSearchURLShouldReturnTargetURL(input String, expected String) : void] in class org.jabref.logic.net.URLUtilTest
JabRef/jabref#14138
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
…ntalis#1003)

jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
This change generates LeafExpression mappings for the tests with a single statement
removeBraces()
equations()
formatStripLatexCommands()
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java
There are 8 parameterized test refactorings
JabRef/jabref#14138
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.

3 participants