Refactor tests to use parameterized tests 676#14138
Conversation
There was a problem hiding this comment.
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.
- Using
->as delimiter to make it more readable - Use text blocks - see https://docs.junit.org/current/api/org.junit.jupiter.params/org/junit/jupiter/params/provider/CsvSource.html#textBlock() (instead of multiple strings)
- Use
#as comment sign --> See https://docs.junit.org/current/api/org.junit.jupiter.params/org/junit/jupiter/params/provider/CsvSource.html#textBlock()
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
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java There are 8 parameterized test refactorings JabRef/jabref#14138
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()
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()
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java There are 8 parameterized test refactorings JabRef/jabref#14138
|
@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
left a comment
There was a problem hiding this comment.
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.
Co-authored-by: “zyan-repository” <“yianzhou003@gmail.com”>
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
…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()
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java There are 8 parameterized test refactorings JabRef/jabref#14138
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
…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()
jablib/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java There are 8 parameterized test refactorings JabRef/jabref#14138
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
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)